November 21st, 2008, 03:44 PM
Linker Error: Undefined Symbol
Hi, I'm programming in C using the Turbo C (TC) and Turbo Debugger (TD). I have a program with some files who share variables and user defined structures.
When I try to build the project, I get these error messages:
- Linker Error: Undefined symbol _MAIN in module CO.ASM (and of course I have a main function)
- Linker Error: Undefined symbol _STACK1 in module TEST.C (this is a module that I use in the main program, where I've defined a variable that I use in TEST.C as extern variable)
- Linker Error: Undefined symbol _STACK2 in module TEST.C (it is curious that I have other shared stack variables between both files and I have no problem with them)
November 21st, 2008, 08:29 PM
The term, "undefined symbol", is not really esoteric. Generally, it means that you have a symbol which has not been defined.
In many cases, this is a linker error, not a compiler error. It tends to mean that you have not properly expressed the necessary constituents of your program.
We can **** around here for a week or two and drive this thread into multiple pages. On the other hand, you might be specific, receive some nice answers, and go home tomorrow, satisfied.
It's kind of your choice. I, for one, am watching with low-level interest.
November 22nd, 2008, 08:54 AM
The linker has found a symbol in one module (declared extern), but found no definition in any module. You have not posted the code - so you tell us where the symbols are defined?
Are you sure that you have added all the source modules to your project?
What are you using such an antique compiler I wonder? We may be able to help you, but the chances are it would be easier if you were using a modern tool. Or even a 21st Century tool! :eek:
November 29th, 2008, 04:46 AM
Linker Error: Undefined Symbol [Solved]
thanks for your answers. I solved the error, as clifford says, it was due to I did not added the module that contains the main class to the project.
I know TC and TD are antique tools, but I have to use them because it's part of a school subject.
November 29th, 2008, 11:37 AM
Schools used to use these tools because they were inexpensive or free. However there are better and more modern tools available for free. The only excuse is that teh teaching material relies on specifics of that compiler, but if your course material has not been updated in 10 years you have to wonder about teh quality.
Originally Posted by hadrien
If your code is ANSI/ISO compliant and does not use proprieatry Borland libraries, it should be entirly portable, so it should not matter what tool you use.