PDA

View Full Version : Can't get to square 0 on Windows



rew
26th June 2009, 07:17
I recently downloaded QT for MS Windows from http://www.qtsoftware.com/downloads.

I've been trying to get a basic "Hello world" program to compile and link and no luck.

I tried to do the qmake -project; qmake hello.pro thing and couldn't get any usable files.

So I figured I'd just create a makefile by hand. Well, I'm in linker hell. The link command looks like this:

link /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib"
/LIBPATH:"c:\Qt\2009.02\qt\lib"
/LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib"
/NOLOGO /DEBUG /MANIFEST /MANIFESTFILE:"debug\hello.intermediate.manifest"
/OUT:hello.exe debug/hello.obj kernel32.lib user32.lib shell32.lib
uuid.lib ole32.lib advapi32.lib ws2_32.lib gdi32.lib winspool.lib comdlg32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libqtmaind.a libQtGuid4.a libQtCored4.a

When I run it I get these errors.

libQtCored4.a(d002026.o) : warning LNK4078: multiple '.text' sections found with different attributes (E0000020)
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QApplication::~QApplication(void)" (__imp_??1QApplication@@UAE@XZ) referenced in function _main
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" (__imp_?exec@QApplication@@SAHXZ) referenced in function _main
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::show(void)" (__imp_?show@QWidget@@QAEXXZ) referenced in function _main
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl QObject::connect(class QObject const *,char const *,class QObject const *,char const *,enum Qt::ConnectionType)" (__imp_?connect@QObject@@SA_NPBV1@PBD01W4Connectio nType@Qt@@@Z) referenced in function _main
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) char const * __cdecl qFlagLocation(char const *)" (__imp_?qFlagLocation@@YAPBDPBD@Z) referenced in function _main
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::~QString(void)" (__imp_??1QString@@QAE@XZ) referenced in function _main
etc.

None of the QT functions are found despite my including libqtmaind.a, libQtGuid4.a, and libQtCored4.a.

And there is that ominous warning about multiple '.text' sections found with different attributes in libQtCored4.a.

When I did a search on that warning there was something about GNU C libraries not being recognized by the Windows linker.

Is there any way to compile and link QT with the Windows cl compiler?

aamer4yu
26th June 2009, 07:52
Did you download the SDK or source code ? If u downloaded SDK, its compiled with mingW and wont be usable with Visual studio as far as I guess.

For running an application on windows follow these steps -
1) qmake -project --- this will generate .pro
2) Modify .pro as per ur needs
3) qmake -tp vc --- this will create a .vcproj file which you can open in Visual Studio
4) build / compile from VS.

Make sure you are including headers in ur application and Qt bin directory is included in ur PATH