0

I am new to Qt and now I am developing a simple application in using Visual Studio 2008 and when am building the code, the following errors occur:

 error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Window::metaObject(void)const " (?metaObject@Window@@UBEPBUQMetaObject@@XZ)

 error LNK2001: unresolved external symbol "public: virtual void * __thiscall Window::qt_metacast(char const *)" (?qt_metacast@Window@@UAEPAXPBD@Z)

 error LNK2001: unresolved external symbol "public: virtual int __thiscall Window::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Window@@UAEHW4Call@QMetaObject@@HPAPAX@Z)

 error LNK2001: unresolved external symbol "public: static struct QMetaObject const Window::staticMetaObject" (?staticMetaObject@Window@@2UQMetaObject@@B)

 fatal error LNK1120: 4 unresolved externals

How can I solve these errors?

johnsyweb
  • 136,902
  • 23
  • 188
  • 247
joki
  • 847
  • 1
  • 10
  • 15
  • 1
    Check for all dependencies ... On Visual Studio go to Project Properties-> Linking and check for qt4 binaries – jose Jan 12 '12 at 09:44

1 Answers1

0

You need to run moc.exe on your header files that use Q_OBJECT macro or inherit from QObject. For simplicity just install this qt vs addin and it will add everything for you. You'll probably will need to generate a new project.

Dmitriy
  • 5,357
  • 8
  • 45
  • 57