[ back to toc ]

compiling multiple source files

Date: 2002/06/14 11:43

i own a macintosh running OS X, which is built on FreeBSD. I am writing
simple programs with no problems, compiling them at the CLI in gcc, and
running them like './appname'

Now i want to split a project into multiple source files, but am having
trouble. No book or website explains how this is done, except in theory.

say i have a file called main.c with the main function in it and a call
to more(), another file called more.c with the more() function, and a
header file called more.h with the prototype of the function more {void

these compile without problems into .o object file, although it warns of
an implicit declaration of more. this makes me think my header file is not
being included? when the linker (ld) trys to combine them into an
executable, it says:
"/usr/bin/ld: Undefined symbols:

i am hoping you have ideas about how to pull this off, i cannot figure it
out. either i am not definining something correctly or the linker is
misconfigured..thanks for your time
Post a followup here with the actual files.


[ back to toc ]