I have following problem:
I want to create Object from class inside main function. Looks like it is a linker problem. Do you have any ideas, what the reaason for this error message could be?
Its error message is:
main.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall Test::Test(class QString)" (??0Test@@QAE@VQString@@@Z)" in Funktion "_main".
main.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall Test::~Test(void)" (??1Test@@QAE@XZ)" in Funktion "_main".
debug\Wth.exe:-1: error: LNK1120: 2 nicht aufgelöste Externe
I have very simple Class Test:
test.h
#ifndef TEST_H
#define TEST_H
#include <QtCore/QObject>
class Test
{
public:
Test(QString name);
~Test();
private:
QString m_name;
};
#endif // TEST_H
then the .cpp file looks like this:
test.cpp
#include "test.h"
Test::Test(QString st) : m_name(st){}
Test::~Test(){}
very basic, in main function I have:
main.cpp
#include <QCoreApplication>
#include "test.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Test t("lam");
return a.exec();
}