PDA

View Full Version : Problem getting Qt 4.3.3 to work with MS Visual Studio 2005 Express



nicksnels
12th January 2008, 18:12
Hi,

I'm trying to get Qt 4.3.3 to work with MS Visual Studio 2005 Express on a Windows Vista 64bit machine. I know I could use Mingw and Eclipse, but I need Visual Studio for another C++ library.

I have installed Visual Studio and Qt 4.3.3 (well unzipped qt-win-opensource-src-4.3.3), I added the bin directory of Qt to the PATH. I opened the Visual Studio 2005 Command Prompt and went to the Qt directory. According to different wikis I read I don't need any patching and I should enter the command: configure -platform win32-msvc2005 . But that doesn't work, I get the error:



C:\Qt\4.3.3>configure -platform win32-msvc2005
Invalid option "win32-msvc2005" for -platform.
See the README file for a list of supported operating systems and compilers.
Usage: configure [-buildkey <key>]
....

Already tried different other combinations, but non of them worked. Thought the installation process would be the easiest one :crying: Hope someone can help me. Thanks.

Kind regards,

Nick

wysota
13th January 2008, 11:47
What happens if you don't pass the platform option at all (run "configure" with no options)? With a bit of luck your VS should be detected automatically.

nicksnels
14th January 2008, 21:11
Nope, doesn't work either. Just running configure without any options gives me:


C:\Qt\4.3.3>configure
Unable to detect the platform from environment. Use -platform command lineargument or set the QMAKESPEC environment variable and run configure again
See the README file for a list of supported operating systems and compilers.

It says to set QMAKESPEC, to what should I set it?

Kind regards,

Nick

wysota
15th January 2008, 00:08
It says to set QMAKESPEC, to what should I set it?

win32-msvc.net

BTW. Looks like you simply forgot the dot between "msvc" and "net". Try adding it, it should work just fine.

bender86
15th January 2008, 07:58
win32-msvc.net
But he says he use MSVC express 2005, so it should be win32-msvc2005.

I too use MVCS Express 2005* on Vista 64, and I got no problem installing Qt. Maybe the extraction went wrong, check if exists a 'mkspecs' directory in %QTDIR%, and if it contains a 'win32-msvc2005' directory. Try also to redownload qt source package.

* Actually I'm using 2008 version, but it worked also when I used 2005.

wysota
15th January 2008, 09:54
Hmm... right... I have to stop answering questions at 1am... I use 2005 myself, but with a 32 bit system.

nicksnels
15th January 2008, 22:45
Thanks for all the replies. Managed to get a bit further. I redownloaded the sources as I was missing quite a few things. Also installed a MS SDK according to the information provided by http://kjell.hedstrom.googlepages.com/qt4_visual_studio_express_2005 . I set QTDIR (c:\Qt\4.3.3),QMAKESPEC (win32-msvc2005) and added the Qt bin directory to the PATH and ran configure - prefix c:\Qt4.3.3 . It runs for a while and compiles things and after a while a get:



Creating qmake...

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

Creating makefiles in src...
Generating Visual Studio project files...
Could not find mkspecs for your QMAKESPEC(win32-msvc2005) after trying:
c:\Qt4.3.3\mkspecs
Error processing project file: C:/Qt/4.3.3/projects.pro
Qmake failed, return code 3

Generating Makefiles...
Could not find mkspecs for your QMAKESPEC(win32-msvc2005) after trying:
c:\Qt4.3.3\mkspecs
Error processing project file: C:/Qt/4.3.3/projects.pro
Qmake failed, return code 3


And then it stops. Any ideas what may be causing this? I have a folder win32-msvc2005 in c:\Qt\4.3.3\mkspecs and it has two files qmake.conf and qplatformdefs.h . Thanks.

Kind regards,

Nick

wysota
16th January 2008, 00:46
Skip the prefix. If you want the prefix, issue "make install_mkspecs" after qmake complains. It should then install the specs to the specified directory and when you restart the configuration process it should work fine. Of course you can also copy the mkspecs directory to the one pointed to by the prefix yourself.

ChristianEhrlicher
16th January 2008, 06:46
The install prefix is really a problem - afaik it's not officially supported on windows. I've had several problems because some libs were not installed into <install_prefix>/bin. The latest one was that qttest(d)4.dll is not copied into there. This will be fixed in 4.3.4 or 4.4.0

wysota
16th January 2008, 08:26
The problem (I also remember encountering it) is that on Windows mkspecs need to be in the prefixed directory for qmake to work even before Qt is compiled. Amazingly this is not an issue on Unix systems.

nicksnels
16th January 2008, 10:31
So, I have just run configure without any options, but I get the same output. Is there a way to clean the output/result of the first configure I ran? Or should I just delete everything in the Qt folder and start all over again? Thanks.

Kind regards,

Nick

wysota
16th January 2008, 11:15
Try "nmake confclean" or "nmake distclean".

nicksnels
16th January 2008, 23:00
Hi,

removed everything and started from scratched. Now if I run configure and nmake everything works. So far for the good news. I also need Postgresql support, which is done with configure -plugin-sql-psql . Which works, but when I run nmake, after a couple of minutes I get:


cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189
-DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FRO
M_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I".
.\..\..\..\include\QtCore" -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include
\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\Qt\4.3.3\inc
lude\ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"..\..\..\..\mkspecs\win32-msvc2
005" -Fotmp\obj\debug_shared\ @C:\Users\SONATA~1\AppData\Local\Temp\nm14A0.tmp
moc_qsql_psql.cpp
link /LIBPATH:"c:\Qt\4.3.3\lib" /LIBPATH:"c:\Qt\4.3.3\lib" /NOLOGO /DEBU
G /DLL /MANIFESTFILE:"tmp\obj\debug_shared\qsqlpsqld.intermediate.manife st" /VER
SION:4.33 /OUT:..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll @C:\Users\SONATA~1\
AppData\Local\Temp\nm1720.tmp
LINK : fatal error LNK1104: cannot open file 'libpq.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 2005
\VC\BIN\link.EXE"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 2005
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

I have already installed Postgresql 8.2.6 and unzipped the binaries to c:\pgsql. I added the necessary items to my environment as described on http://trolltech.com/developer/knowledgebase/faq.2007-06-28.7933143318/ . As always, all help is really appreciated.

Kind regards,

Nick

wysota
16th January 2008, 23:11
Did you set the proper environment variables? Does "echo %LIB%" return C:\pgsql\lib (or similar) among the entries?

nicksnels
17th January 2008, 21:04
Hi,

I double checked everything, and the environment variables are all set as described on the Qt website.

I restarted from scratch, unzipped the source, ran configure -plugin-sql-psql and nmake and I get the same error as I mentioned in my last post. It says it can't find libpq.lib and thats because I don't have it. I only have libpq.a and libpq.dll in c:\pgsql\lib . All tips are welcome ;) Thanks.

Kind regards,

Nick

wysota
17th January 2008, 21:45
Then you have PostgreSQL libraries built for MinGW and not MSVC. You need to get a copy built for MSVC.

nicksnels
18th January 2008, 22:09
Ok, I managed to get it compiled without any errors :) Thank you to everybody who helped me. Especially wysota, thanks for sticking out with me, couldn't have done it without your help!

For those of you who might get the same errors. The Postgresql files you need are included with the standard Windows installer. You only need to make sure to also install the Development option (they are all the way down the bottom of the installation options). You also need to add the following environment variables:

INCLUDE: C:\Program Files\PostgreSQL\8.2\include
LIB: C:\Program Files\PostgreSQL\8.2\lib;C:\Program Files\PostgreSQL\8.2\lib\ms (NOTE: I had to add the lib\ms directory otherwise nmake couldn't find libpq.lib which is located in that directory)
PATH: C:\Program Files\PostgreSQL\8.2\bin

That basically is it. It's not that hard, it only took me a couple of days to figure it out. And compilation takes a really long time :crying: Now I can finally start on my first project, so I'll be back :cool:

Kind regards,

Nick