Hey all, I have a problem building my application when using a custom widget.
I'm using the custom widget "tictactoe" that came with the examples.
For creating the project files I used the following steps:
- cd C:\Qt\4.4.2\projects\Test\Test
- qmake -project
- qmake -tp vc test.pro
- Added "C:\Qt\4.4.2\examples\designer\taskmenuextensi on" to the project include list in visual studio.
I'm getting the following link error when building my project:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall TicTacToe::TicTacToe(class QWidget *)" (??0TicTacToe@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_MyTest::setupUi(class QMainWindow *)" (?setupUi@Ui_MyTest@@QAEXPAVQMainWindow@@@Z) mytest.obj
Error 2 fatal error LNK1120: 1 unresolved externals debug\test.exe
//main.cpp
#include <QApplication>
#include "mytest.h"
int main(int argc, char *argv[])
{
MyTest mytest;
mytest.show();
return app.exec();
}
//main.cpp
#include <QApplication>
#include "mytest.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyTest mytest;
mytest.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
//mytest.cpp
#include <QtGui>
#include "mytest.h"
{
setupUi(this);
}
//mytest.cpp
#include <QtGui>
#include "mytest.h"
MyTest::MyTest(QMainWindow *p_Parent) : QMainWindow(p_Parent)
{
setupUi(this);
}
To copy to clipboard, switch view to plain text mode
//mytest.h
#ifndef MYTEST_H
#define MYTEST_H
#include "ui_mytest.h"
{
Q_OBJECT
public:
};
#endif
//mytest.h
#ifndef MYTEST_H
#define MYTEST_H
#include "ui_mytest.h"
class MyTest : public QMainWindow, private Ui::MyTest
{
Q_OBJECT
public:
MyTest(QMainWindow *p_parent = 0);
};
#endif
To copy to clipboard, switch view to plain text mode
I only get this error when I use a custom widget. Because when I remove the custom widget from my ui file I can successfully build and run the application.
Bookmarks