sys info : win xp SP3 , Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
Microsoft .NET Framework Version 3.5 SP1
Qt Add-in 1.1.5
I installed Qt 4.6.3 from the site http://qt.nokia.com/downloads/windows-cpp-vs2008. Then I added the Add-in Qt 1.1.5 and configured the PATH variable.
When I open a new QT project , default example works just fine.
On Nokia (qt) site I found some examples but it seems that things are not working properly.
Here is one of many examples that do not work :
#include <QtGui>
#include <QWidget>
class QLabel;
class QLineEdit;
class QTextEdit;
class AddressBook : public QWidget
{
Q_OBJECT
public:
AddressBook(QWidget *parent = 0);
private:
QLineEdit *nameLine;
QTextEdit *addressText;
};
AddressBook::AddressBook(QWidget *parent)
: QWidget(parent)
{
QLabel *nameLabel = new QLabel(tr("Name:"));
nameLine = new QLineEdit;
QLabel *addressLabel = new QLabel(tr("Address:"));
addressText = new QTextEdit;
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(nameLabel, 0, 0);
mainLayout->addWidget(nameLine, 0, 1);
mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop);
mainLayout->addWidget(addressText, 1, 1);
setLayout(mainLayout);
setWindowTitle(tr("Simple Address Book"));
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
AddressBook addressBook;
addressBook.show();
return app.exec();
}
Compiler says this ::
Output Window
Linking...
main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall AddressBook::metaObject(void)const " (?metaObject@AddressBook@@UBEPBUQMetaObject@@XZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall AddressBook::qt_metacast(char const *)" (?qt_metacast@AddressBook@@UAEPAXPBD@Z)
main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall AddressBook::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@AddressBook@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
main.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const AddressBook::staticMetaObject" (?staticMetaObject@AddressBook@@2UQMetaObject@@B)
C:\Documents and Settings\nik\My Documents\Visual Studio 2008\Projects\vs_03\Debug\vs_03.exe : fatal error LNK1120: 4 unresolved externals
Results
Build log was saved at "file://c:\Documents and Settings\nik\My Documents\Visual Studio 2008\Projects\vs_03\vs_03\Debug\BuildLog.htm" vs_03 - 5 error(s), 0 warning(s)
It seems to me that the thing has to do with the use of macro Q_OBJECT but just dont know what to do that thing starts to work properly.
Maybe wrong installation or ... NO IDEA
Any help is appreciated.