#PD Compiler help
4 messages in this thread
I'm really going crazy. I'm trying to end up with something I can
learn C with. I'm just starting out. I've been reading what I can find on
the subject, but I can only absorb so much without getting any hands-on.
The problem is, it almost seems that you have to be fairly comfortable with
it just to know what you need in terms of include and runtime libraries. I
was really about to give up on it when I ran across some include files to
use with Sozobon C, the PD compiler I'm trying to get to fly. I thought I
had made quite a breakthough until it wouldn't link right. I'm using A68k
and Blink, they were included in the archive and the compiler was actually
written around them. Blink tells me that printf is undefined. I'm
confused. I thought that was what stdio.h was for. Why are there still
undefined functions? Do I need a runtime library and if so, might I find
one in lib 9? I browsed for something like that but it turned up nothing.
I know this must sound pretty stupid to even an intermediate programmer,
but I sure could use a hand.
Thnx
Steve
Steve,
.h files are where you define macros such as
#define max((a),(b)) ((a) > (b) ? (a) : (b))
#define TRUE 1
#define FALSE 2
or global variables, structure definitions, etc.
runtime libraries have functions 'precompiled' in them such as
printf() or open(), etc. At link time, the linker reads your code and any
functions that are called in your code, but that don't exist in your code
are pulled from the library and made part of the executable that the linker
produces. Thus, any function that you don't create, but that you use in
your program must be included in one of the link libraries.
All the Amiga specific functions are in a library called amiga.lib
and it's available from Commodore as part of the 'AmigaDOS v1.3 Native
Developer's Update' kit for $20. This package also includes the Amiga
include files (the .h files).
That's all you'd need as long as you stick with Amiga specific
functions. If you want to use standard C functions (such as printf) you'd
have to find, or write your own c.lib
Don
Steve,
Whoops…sorry for the mis-type. While you certainly could define
FALSE to be equal to anything you wanted, it's normally defined as 0 like
this:
#define FALSE 0
Don
If you are getting "printf undefined" messages from Blink, you have to
include your libraries on the BLINK command line with a LIB statement or
use it in a WITH file to reference the library.
BobS