Qt 4.6 with VS 2008 Express: Linker error when building libraries
Hi,
I want to use QT4.6 with VS 2008 Express.
I have roughly followed this guide: http://netindonesia.net/blogs/risman...c-express.aspx
I have downloaded and installed Qt libraries 4.6 for Windows (VS 2008, 190 MB, http://qt.nokia.com/downloads/windows-cpp-vs2008)
Then i opened a VS2008 Command Prompt and typed:
configure -platform win32-msvc2008
=>OK
nmake
=>gives the following linker error:
Generating Code...
link /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFEST /MANIFESTFILE:
"release\moc.intermediate.manifest" /OUT:..\..\..\bin\moc.exe @C:\DOCUME~1\Max\LOCALS~1\Temp\nm92.tmp
bootstrap.lib(qbytearray.obj) : error LNK2019: unresolved external symbol _uncompress referenced in function "class QByteArray __cdecl qUncompress(unsigned char const *,int)" (?qUncompress@@YA?AVQByteArray@@PBEH@Z)
bootstrap.lib(qbytearray.obj) : error LNK2019: unresolved external symbol _compress2 referenced in function "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z)
..\..\..\bin\moc.exe : fatal error LNK1120: 2 unresolved externals
Any hints on this?
It seems the functions mentioned are part of zlib?
Do i need to install zlib seperately? From where and how?
Any help will be much appreciated.
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Why not just download the VS2008 version of Qt from Nokia's website?
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
That's what i did.
I tried with both the source- and SDK distribution.
Same issue.
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Ok, I'm confused. Is there a reason you want to reconfigure/rebuild the library when they have already been made for you?
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Well, isn't this what the official deployment guide for Windows (http://doc.qt.nokia.com/4.6/install-win.html) suggests to do?
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
If you want to configure the suite differently for deployment (ie, you want to disable some stuff perhaps) then yes, thats correct. But from your first post you just want the standard version, which has already been done for you.
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Ok, so i tried using the pre-built libs.
I can compile an example (calculator), but i get linker errors.
I have added the Qt/4.6.0/lib diretcory to the VS2008 Linker lib path, but that doesn't seem to be sufficient.
Any clues?
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Normally you would let the Qt plugin for VS do all the work for you, but since you are using an express edition, you can't do that. So you need to figure out your project dependancies and add them to your project linker section. These will be things like QtCore, QtGUI, and so on.
You can probably use QMake to generate an appropriate project file for you - create the .PRO file either yourself or using QtCreator and then change the platform configuration.
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Ok, i now have added all Qt lib files to the project and this reduced the number of unresolved symbols.
There are still these though:
1>button.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Button::metaObject(void)const " (?metaObject@Button@@UBEPBUQMetaObject@@XZ)
1>button.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Button::qt_metacast(char const *)" (?qt_metacast@Button@@UAEPAXPBD@Z)
1>button.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Button::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Button@@UAEHW4Call@QMetaObject@@HPAP AX@Z)
1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Calculator::metaObject(void)const " (?metaObject@Calculator@@UBEPBUQMetaObject@@XZ)
1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Calculator::qt_metacast(char const *)" (?qt_metacast@Calculator@@UAEPAXPBD@Z)
1>calculator.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Calculator::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@Calculator@@UAEHW4Call@QMetaObject@@ HPAPAX@Z)
1>calculator.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Calculator::staticMetaObject" (?staticMetaObject@Calculator@@2UQMetaObject@@B)
1>calculator.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Button::staticMetaObject" (?staticMetaObject@Button@@2UQMetaObject@@B)
1>D:\Dev\calculator\Debug\calculator.exe : fatal error LNK1120: 8 unresolved externals
Any ideas?
Re: Qt 4.6 with VS 2008 Express: Linker error when building libraries
Yes, you need to run MOC on the appropriate header files and include the resulting output in your project. The plugin typically associates MOC with the header files for you so it's run whenever the header files are updated. You'll have to do this manually since you don't have the plugin.