Beginner Compiling samples
-
Im just starting out, I downloaded the QT SDK and installed it. I am on Win 7 64, and the compiler I use is visual studio 2010. Qt Creator seems to give me the option for that compiler so I set that, it also had trouble finding cl, so I added that to the path. None of the samples seem to compile, here is the clock sample and what I get:
@
09:49:10: Running build steps for project analogclock...
09:49:10: Starting: "c:\qtsdk\desktop\qt\4.8.1\msvc2010\bin\qmake.exe" C:\QtSDK\Examples\4.7\widgets\analogclock\analogclock.pro -r -spec win32-msvc2010 "CONFIG+=release"
09:49:10: The process "c:\qtsdk\desktop\qt\4.8.1\msvc2010\bin\qmake.exe" exited normally.
09:49:10: Starting: "C:\QtSDK\QtCreator\bin\jom.exe"
cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtCore" -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtGui" -I"........\Desktop\Qt\4.8.1\msvc2010\include" -I"........\Desktop\Qt\4.8.1\msvc2010\include\ActiveQt" -I"release" -I"..\analogclock" -I"." -I"........\Desktop\Qt\4.8.1\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\RVILLA~1\AppData\Local\Temp\analogclock.obj.1352.15.jom
cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtCore" -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtGui" -I"........\Desktop\Qt\4.8.1\msvc2010\include" -I"........\Desktop\Qt\4.8.1\msvc2010\include\ActiveQt" -I"release" -I"..\analogclock" -I"." -I"........\Desktop\Qt\4.8.1\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\RVILLA~1\AppData\Local\Temp\main.obj.1352.15.jom
C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtCore" -I"........\Desktop\Qt\4.8.1\msvc2010\include\QtGui" -I"........\Desktop\Qt\4.8.1\msvc2010\include" -I"........\Desktop\Qt\4.8.1\msvc2010\include\ActiveQt" -I"release" -I"..\analogclock" -I"." -I"........\Desktop\Qt\4.8.1\msvc2010\mkspecs\win32-msvc2010" -D_MSC_VER=1600 -DWIN32 ..\analogclock\analogclock.h -o release\moc_analogclock.cpp
C:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Release
jom: C:\QtSDK\Examples\4.7\widgets\analogclock-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Release\Makefile.Release [release\analogclock.obj] Error 2jom 1.0.8 - empower your cores
jom: C:\QtSDK\Examples\4.7\widgets\analogclock-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2010__Qt_SDK__Release\Makefile [release] Error 2
09:49:10: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project analogclock (target: Desktop)
When executing build step 'Make'
@
I would appreciate any assistance.[Edit: Added @ tags for clarity/formatting -- mlong]
-
AFAIK you can not "mix the compilers like this":http://www.mingw.org/wiki/MixingCompilers. The libraries were compiled with MinGW, you are using MSVC (via Visual Studio).
If you must use MSVC you must compile Qt with Visual Studio (or from commandline) on your own. -
Strange, are you using the open source version of Qt?
According to "this article":http://doc.qt.digia.com/4.7/install-win.html, you need to compile Qt with the Microsoft Compiler first. Never done it myself before but I will do so in near future.
-
"This one is much better":http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MSVC
-
Build the Qt framework only if you really need to build it, because you can find already built with VS 2010 binaries to install at the "download section":https://qt-project.org/downloads (look for Qt libraries 4.8.3 for Windows (VS 2010, 235 MB) ) also you will most likely need the Qt Visual Studio Add in, this will install the Qt menu in Visual Studio (scroll down on the same download page and you will find the download there)
//you can also find the source code for Qt framework - if you decide you need to build it yourself.
-
Missed that, too. I could swear that wasn't there... :-)
-
There's a further twist. I too had the error. I have Qt 4.8.3 and Qt Creator 2.6.0 installed on Windows Vista Premium.
I believe the problem exisits for those who wish to compile Qt projects from within Qt Creator, which ever compiler you choose.
For compiler, I tried windows MinGW 4.4.0 then MS Visual Studio Express 2010 C++ compiler, on each loading the compiler settings into the Qt Creator Tools->Options->Build & Run->Kits->Compiler and Compiler and CMake settings.
In both cases I used the code from the Qt 4.8.3 examples dir and building gave the error:
The process "C:\Qt\qtcreator-2.6.0\bin\jom.exe" exited with code 2.
I found the reason was there was no Makefile generated because qmake was not run within Qt Creator build configuration. I tried adding it prior to the compile command but to no effect.
I added the qmake.exe path to $PATH in the Build Environment but no good.
I added the same to the CtrlPanel->System->Advanced Settings->Environment->PATH
I could then run qmake from a command prompt, generate the Makefile. I could compile from within Qt Creator then, but not run. I could however run the example executable I'd built from the command-line prompt.
Hope this helps. I'm quite a fan of Qt, but more so with the Linux installations which seem to run out of the box. The windows installation should do the same and bundle whatever it needs IMOP.
-
I should add the MS Visual Studio Express 2010 C++ is free but as the plugin for Qt Creator doesn't work with the Express edition the compiler doesn't seem to call qmake automatically within Qt Creator.
I will continue to investigate. The MinGW route may not require a plugin to call qmake but this all shouldn't be necessary IMOP. -
Intriguing. The user environment variable $PATH C:Qt\4.8.3\bin seems enough to allow me to re-build and run the example project from within Qt Creator. Doing the same inside Qt Creator build environment didn't work, so the plugin isn't needed if you use Qt Creator and not MS Visual Studio. Hope this helps.
-
@Boysie: I can not follow your description of the problem you ran into.
You mention cmake... what has that to do with anything? If you set up a cmake project then creator will of course not run qmake as that is a completely different build system. Creator will make sure the Qt binaries are in the PATH whenever it runs anything. So far I never got any complaints that this fails to work, you are the very first. So what exactly are you doing? What kind of project is it? Did you open it via a CMakeLists.txt file or a whatever.pro file?
Yes, development on Linux is much simpler than on Windows, I fully agree with you there. We can not ship the MS tools for building software for legal reasons. There is no way around that. We did put the mingw tools into the Qt SDK, but IIRC don't do so in the stand-alone Qt Creator installer. That is supposed to be as small as possible... people do complain about the download sizes when we include extra stuff, especially those that have a mingw set up already.