Linker Error:Undefined Symbol ATM_c::run() in module Project.cpp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KBSethna
    New Member
    • May 2012
    • 1

    Linker Error:Undefined Symbol ATM_c::run() in module Project.cpp

    Linker Error:Undefined Symbol ATM_c::run() in module Project.cpp
    Linker Error:Undefined Symbol ATM_c::ATM_c() in module Project.cpp


    ATM_c is a class having a function run() and a constructor.
    Declared in .h file and defined in .cpp file.
    When I call it in main through the code
    Code:
    main
    {
    ....
    ....
    ATM_c atm;
    atm.run();
    ....
    ....
    }
    it gives the above two errors.
    Can someone please help with this...
    Last edited by Meetee; May 4 '12, 06:39 AM. Reason: code tags added
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Sounds like you haven't linked the object created by compiling ATM_c.cpp.

    When you have more than 1 cpp file you have to compile each file individually to produce and object file for each and then link all those objects, together with an relevant libraries into an executable.

    You would get your error if you compiled and linked main.cpp without ATM_c.cpp

    If you are using an IDE it should sort all this out for you.

    Comment

    Working...