test app complains about missing symbols in a custom lib file.

Started by
3 comments, last by Enerjak 10 years, 5 months ago

OK, as the title says, for some god awful reason, the test app I'm using to test my custom lib doesn't find= the symbols....

I want to test the vector class:


#include "..//DemEngine/DemVector2.h"

using namespace std;


int main()
{
	DemVector2 v;
	return 0;
}

I'm including the lib by adding it to the linker property so that's not the problem and the library compiles fine, for some reason, the application doesn't want to find the symbol.


1>------ Build started: Project: DemApp, Configuration: Debug Win32 ------
1>  main.cpp
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall DemVector2::DemVector2(void)" (??0DemVector2@@QAE@XZ) referenced in function _main
1>C:\Users\Rosario\documents\visual studio 2010\Projects\DemEngine\Debug\DemApp.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========


since the project is stupidly small, I'm going to upload it in this post This is something that MAKES no sense to me so hopefully someone can answer me and give me a pointer to make sure this never happens again.

Advertisement

You haven't implemented the default constructor for DemVector2. EDIT: You declared it, but didn't define it.

This would do it:


class DemVector2
{
private:
    double m_X;
    double m_Y;
public:
    DemVector2() {}    // default constructor. Note the curly brackets here to actually define the function rather than just declare it.
    // etc.

Or move the implementation to the cpp file.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

But you do see in the project I attached that I do that right? or didn't you open the project? cause I do do that

I opened the project. You didn't define the default constructor you just declared it, you did this

DemVector2(); // this is just a declaration

You either need this:

DemVector2() {} // this is a declaration and an implementation

or add

DemVector2::DemVector2()

{

}

to your cpp file.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

Yea....that didn't work. Did it work for you when you did it? cause for me it is not.

This topic is closed to new replies.

Advertisement