Page 1 of 1

Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 5:00 am
by srg
Hi

I have a program in which my video routines are in a secndary module video.c, its prototypes are in video.h. My main function is in a module called main.c. My Main function at the moment calls just one of the video routines and it compiles fine but I get a linker error:

?Linker Error: Undefined symbol _Print_Char in module MAIN.C

I include the header file just fine and it compiles so what is going wrong?

Thanks

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 5:06 am
by Tim
Are you actually linking both object files after compiling them? The header file just lets the compiler know the functions are available; it doesn't include them into the output. You need to specify the names of both object files on the linker command line.

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 5:06 am
by Pype.Clicker
did you give both video.o and main.o files to the linker ?
the trick is to compile your file separately ( *.c -> *.o) and then to give all .o files to the linker in order to produce a single .bin file

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 5:26 am
by srg
Pype.Clicker wrote: did you give both video.o and main.o files to the linker ?
the trick is to compile your file separately ( *.c -> *.o) and then to give all .o files to the linker in order to produce a single .bin file
I just went run in the run menu of the IDE

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 6:46 am
by srg
I just went run in the run menu of the IDE
hmm Interesting, it worked fine from the command line, is the IDE crap?? Shame if it is , as the Turbo Pascal one was great (for Pascal of course :))

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 8:16 am
by Pype.Clicker
you cannot just run if you have a multi-module project: you must build it first.... unlike pascal, C isn't interpretable...

Re:Multiple module problems in Turbo C++

Posted: Fri Aug 23, 2002 9:36 am
by Tim
Pype.Clicker means to say that, unlike Pascal, C doesn't take care of linking and dependencies for you. You have to compile each source file separately and link them into one executable; to do you, you probably need to create a project and add all your source files there.

Re:Multiple module problems in Turbo C++

Posted: Mon Aug 26, 2002 2:54 am
by Pype.Clicker
hum, yes... tnx for the translation, Tim ... that was one-hand-only typed in a hurry ;)