Another "Error: Unresolved symbol" Problem

3 posts / 0 new
Last post
sschindler
sschindler's picture
Offline
Joined: 13 Jan 2012
Posts:
Another "Error: Unresolved symbol" Problem

Hey there,

 

I'm getting "unresolved Symbol ABC" error when building my project every time I'm calling the constructor of my own classes in my main method.

 

I've created a minimalistic example. Here's the code:

/*
 * TestClass.h
 *
 *  Created on: 19.01.2012
 *      Author: s.schindler
 */

#ifndef TESTCLASS_H_
#define TESTCLASS_H_

#include 

using namespace MAUtil;

class TestClass {
public:
	TestClass(int i, String str);
	virtual ~TestClass();

private:
	int i;
	String str;
};

#endif /* TESTCLASS_H_ */
/*
 * TestClass.cpp
 *
 *  Created on: 19.01.2012
 *      Author: s.schindler
 */

#include "TestClass.h"

TestClass::TestClass(int i, String str) : i(i), str(str) {}

#include "TestClass.h"

/**
 * Entry point of the program. The MAMain function
 * needs to be declared as extern "C".
 *
 *
 */
extern "C" int MAMain()
{
	TestClass *test = new TestClass(5,"Hello");
	return 0;
}

 

When building the project, I get this Error: "Error: Unresolved symbol '__ZTV10TestClass'" in TestClass.cpp at the line where I'm implementing the constructor.

 

You can see my build settings in the attachment.

 What am I doing wrong?

 

Thanks in advance!

AttachmentSize
Build_settings.png284.86 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi, sorry for the delay.

It looks like you've defined a destructor

virtual ~TestClass();

But not provided any code for it. Try

virtual ~TestClass() {}

sschindler
sschindler's picture
Offline
Joined: 13 Jan 2012
Posts:

Hi,

aww yeah, the missing implementation of the defined destructor is the reason for these linkin-errors...
you made my day !!!

Thanks alot :-)