errorLNK2019 - I need some help!
Posted: Thu Dec 17, 2009 7:40 pm
Hi guys
I'm rather new to Visual Studio 2008 and C++. Recently, I was coding some classes for a 3D vector and 4x4 matrices. I wanted to test the operator overloading for multiplication between a vector and a matrix, so I wrote a MessageBox function within WinMain to output the x-coordinate of the resultant vector when a vector (1.0f, 1.0f, 1.0f) was multiplied by a translation matrix which was to translate by (1.0f, 1.0f, 1.0f) (so the result would have been 2.0f). All the code compiled fine, but I then encountered a slew of linker errors which looked like this:
Error 1 error LNK2019: unresolved external symbol "public: float __thiscall cn::vector3::X(void)const " (?X@vector3@cn@@QBEMXZ) referenced in function _WinMain@16 testm.obj cyanide
Error 2 error LNK2019: unresolved external symbol "public: class cn::vector3 & __thiscall cn::vector3::operator=(class cn::vector3 const &)" (??4vector3@cn@@QAEAAV01@ABV01@@Z) referenced in function _WinMain@16 testm.obj cyanide
I searched on Google for this error but all the advice given was something about not being able to find libraries. However, in this case, I was not using any libraries. In addition, all the files (header and cpp) were in the same place, which was the same folder that the .vcproj file was in. Since all my files were in the same place, how is it that linker errors can still occur.
Furthermore, I tried editing the VC++ Directories to make it point to my project folder for both Include and Source. Didn't work. Does anyone have suggestions as to how I can get around this problem?
Thanks!
I'm rather new to Visual Studio 2008 and C++. Recently, I was coding some classes for a 3D vector and 4x4 matrices. I wanted to test the operator overloading for multiplication between a vector and a matrix, so I wrote a MessageBox function within WinMain to output the x-coordinate of the resultant vector when a vector (1.0f, 1.0f, 1.0f) was multiplied by a translation matrix which was to translate by (1.0f, 1.0f, 1.0f) (so the result would have been 2.0f). All the code compiled fine, but I then encountered a slew of linker errors which looked like this:
Error 1 error LNK2019: unresolved external symbol "public: float __thiscall cn::vector3::X(void)const " (?X@vector3@cn@@QBEMXZ) referenced in function _WinMain@16 testm.obj cyanide
Error 2 error LNK2019: unresolved external symbol "public: class cn::vector3 & __thiscall cn::vector3::operator=(class cn::vector3 const &)" (??4vector3@cn@@QAEAAV01@ABV01@@Z) referenced in function _WinMain@16 testm.obj cyanide
I searched on Google for this error but all the advice given was something about not being able to find libraries. However, in this case, I was not using any libraries. In addition, all the files (header and cpp) were in the same place, which was the same folder that the .vcproj file was in. Since all my files were in the same place, how is it that linker errors can still occur.
Furthermore, I tried editing the VC++ Directories to make it point to my project folder for both Include and Source. Didn't work. Does anyone have suggestions as to how I can get around this problem?
Thanks!