#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Exclamation 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)

    Any idea?

    Thanks!
  2. #2
  3. Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jun 2005
    Posts
    5,964
    Rep Power
    4852
    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.
    Write no code whose complexity leaves you wondering what the hell you did.
    Politically Incorrect DaWei on Pointers Grumpy on Exceptions
  4. #3
  5. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,117
    Rep Power
    1803
    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:

    Clifford
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Thumbs up Linker Error: Undefined Symbol [Solved]


    Hi,

    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.

    See you.
  8. #5
  9. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,117
    Rep Power
    1803
    Originally Posted by hadrien
    I know TC and TD are antique tools, but I have to use them because it's part of a school subject.
    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.

    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.

    Clifford

IMN logo majestic logo threadwatch logo seochat tools logo