Thread: linker error message

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    7

    linker error message

    when compiling my code (it's nothing complicated its just console visua c++)

    anyway it comes up with this

    Code:
    Linking...
    poker.obj : error LNK2019: unresolved external symbol "public: __thiscall Player::~Player(void)" (??1Player@@QAE@XZ) referenced in function _main
    Debug/poker.exe : fatal error LNK1120: 1 unresolved externals
    any ideas why this is happening?

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Did you forget to define the destructor of Player ?. Have you defined the destructor in another .cpp file and forgotten to add that to the project ?
    Lots of questions. Need to see some code to answer.
    Kurt

  3. #3
    Linker.exe64
    Join Date
    Mar 2005
    Location
    Croatia,Pozega
    Posts
    37
    I agree with Zuk. Maybe you just defined prototype in class , ~Player(); , and left it without body. You need to define it somewhere. Just type
    Code:
    Player::~Player(){}
    ,
    or if you don't need to do anything in destructor, you can write destructors body in class.
    e.g.
    Code:
    class Player
    {
    public:
        ~Player(){}
    };
    Code:
     
         .J?+.                             ?`+.
       .+1P .++.                         ,+` 4++.
      .+zq\ .:.?i                      .!`?  .yz+.
      ?zdd ..:.^`J.                   ,!..?...Kyz+	
     .+dXM ..!p^.N.+                 ,,^.a..`.#XO+.
     .zwWM ^`.Mc`JMhJ.             .:JF`JM..^.#WOz`
      jwpMr`..NF.JMMM,!           .JMMF.dJ..`JNWrc
       0Wgb `!B:.MMMMM,:         ,.MMMF.j$.` NHSZ`
        TWMp`.+;`MMMMMM.:       ;.MMMMM.;+``JHW=	
          7Mh,``JMMMM"`          .TMMMMb``.H#"`
    

  4. #4
    Registered User
    Join Date
    Sep 2005
    Posts
    7
    thanks guys spot on i hadn't defined the destructor, I'm new to c++ programming having emigrated from java

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker problem... no idea
    By cyreon in forum C Programming
    Replies: 2
    Last Post: 04-03-2009, 02:53 PM
  2. linker
    By George2 in forum C++ Programming
    Replies: 6
    Last Post: 02-23-2008, 01:25 AM
  3. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 07:42 AM
  4. Linker errors when compiling
    By The Wazaa in forum C++ Programming
    Replies: 4
    Last Post: 10-07-2006, 12:55 PM
  5. MSVis-Studio C++ libraries and linker errors
    By kellydj in forum Windows Programming
    Replies: 10
    Last Post: 03-12-2002, 02:03 PM