Jonathon McKitrick <[EMAIL PROTECTED]> writes: > dogma:...files/programs/objc> gcc -lobjc main.m printer.m -o testme ------
In source code, you have to define (or at least declare) symbols before you reference them. When linking, it's the other way around - the linker only includes objects it knows are needed because they define symbols which were referenced by previously included objects. I don't know about Objective C, but what happens for plain C is this: the linker starts out knowing it needs the entry point (called _start). It reads the run-time library (crt.o), which contains _start and references but does not define main, which is added to the list of unresolved symbols. Then it reads the first object file specified, which hopefully defines main and references a bunch of other symbols which are defined in object files and libraries specified later on the command line, and so forth until there are no more unresolved symbols. In other words: always specify libraries at the end of the compiler or linker command line. DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message