kevin42
kevin42

Reputation: 2128

Building Opensource Qt for Visual Studio 2005/2008

Does anyone have instructions on building the opensource version of Qt? Now that the repository is opened up, I'm trying to build for VS2008 but I'm getting errors when it tries to build qmake.

I found the question I'm looking to use Visual Studio to write and compile using the open source version of Qt4 but this information is out of date, and doesn't really help me. For reference, here's what happens when I try to build with configure -platform win32-msvc2008

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

        cl -c -Foproject.obj  -W3 -nologo -O2  -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac  -
IC:\dev\open_source\qt\include -IC:\dev\open_source\qt\include\QtCore  -IC:\dev\open_source\qt\include -IC:\dev\open_sou
rce\qt\include\QtCore  -IC:\dev\open_source\qt\src\corelib\global  -IC:\dev\open_source\qt\include\QtScript  -IC:\dev\op
en_source\qt\mkspecs\win32-msvc2008   -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL
  -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD  -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D
QT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED   -DQMAKE_OPENSOURCE_EDITION project.cpp
project.cpp
c:\dev\open_source\qt\src\corelib\tools\qstringlist.h(45) : fatal error C1083: Cannot open include file: 'QtCore/qalgori
thms.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Building qmake failed, return code 2

Upvotes: 6

Views: 7500

Answers (6)

Dan G
Dan G

Reputation: 63

What user156973 said. Install ActiveState perl and run configure again.

Upvotes: 0

Stephen Schaub
Stephen Schaub

Reputation: 496

Note that Nokia, as of Qt 4.6, is now providing their own open source VS builds of Qt, so it is no longer necessary to build from source yourself to do development with Visual Studio. Access their open source download page, and look for builds named (e.g.) qt-win-opensource-4.6.1-vs2008.exe.

Upvotes: 2

gabeiscoding
gabeiscoding

Reputation: 534

Also, if you simply want to compile with MSVC so you can develop with the open source libraries with visual studio, I put together a project to provide "pre-built" Qt LGPL libraries with MSVC 2008.

It might be helpfull and has the advantages of taking up less space then compiling it yourself. It also provides a command prompt with all your environment variables set up for you and a link to launch Visual Studio with a Qt environment. It's called qt-msvc-installer.

Upvotes: 1

izogfif
izogfif

Reputation: 7565

Please, ensure that you have ActiveState Perl installed

Upvotes: 5

user44484
user44484

Reputation:

Well, one helpful thing is to run configure inside the Visual Studio Command Prompt. That should be available in the Visual Studio start menu group under Visual Studio Tools.

Also now when you run configure you don't have to specify target platform, because it will be set as an environment variable by the VS Command Prompt.

I got errors from configure and nmake when I did not use the VS Command Prompt, and since switching I have not had any issues.

So the simple instructions would be:

1) open VS command prompt

2) navigate to qt folder where configure.exe is located

3) configure

4) nmake

Upvotes: 8

Arnold Spence
Arnold Spence

Reputation: 22292

This blog article seems to have more recent information on building Qt with visual studio. Hope it helps.

Upvotes: 4

Related Questions