Click to See Complete Forum and Search --> : Another linker error.


Fatboy
October 22nd, 2004, 07:17 PM
I'm working on a program involving 2D graphics. I don't know much about good design but I just do what works, or should work if the linker doesn't SCREW ME UP GOOD EVERY ****ING TIME! I have declared a class called particle in Particle.h, my main execution commands by the way, are all in a file called States.cpp. The program isn't finnished, but what it's supposed to do at this stage is to show one particle inside a window and make the particle vibrate. There are no compiler errors as usual but, just a couple of linker errors. Here is the compile log as it is shown on MS Visual C++ 6.0:

--------------------Configuration: States - Win32 Debug--------------------
Compiling...
States.cpp
Linking...
States.obj : error LNK2001: unresolved external symbol "public: __thiscall particle::~particle(void)" (??1particle@@QAE@XZ)
Debug/States.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

States.exe - 2 error(s), 0 warning(s)


Now, what does that mean? I would appreciate any help at all!

THANK YOU VERY MUCH!!!!!!!!!!!!!!!!

j0nas
October 23rd, 2004, 01:06 AM
My somewhat limitted C++ knowledge says you have private destructor (or at least not accessible). Make sure "~particle(void)" stays public in your class declaration.

Fatboy
October 23rd, 2004, 07:07 AM
I have a public destructor, I just didn't define it. Is it compulsary to define it?

Ejaz
October 23rd, 2004, 08:49 AM
The compiler finds the signatures of the destructor, so there is no problem in compiling, but when the linker try to attach the implementation, it doesn't find it, so it start complaining. Define the destructor and it will move on.

Fatboy
October 23rd, 2004, 09:11 AM
Oh! Thanks.