Qt Creator/designer and MSVC2008?



  • OK, this issue has been up before, I know. But in that case people seem to want to use Visual Studio and some Qt add-in.

    What I want is use Qt Creator as IDE, but compile with MS Visual 2008 C++ compiler. Simply because

      • I think Qt Creator/designer looks like a nice IDE and
      • I need to be able to use WinSCard library (which is part of MSVC SDK).

    So how do I do? Which Qt products do I need to compile for msvc2008? I'v identified following parts:

      • Qt SDK (latest version 1.1.3)
      • Qt Creator (latest version 2.3.1)
      • Just Qt. I think it's the same as Qt Lib? (latest version 4.7.4)
        Maybe Qt Creator and Qt Lib is included in the SDK?

    Anyway I've installed Qt SDK and there is a directory "C:\QtSDK\Desktop\Qt\4.7.4\msvc2008" which implies there should be possible to build for msvc2008? I hav also installed MSVC 2008 Express.

    This may be an easy one for the "mad scientists" (I hope) but as a "Lab Rat" I'm kind of confused how to proceed...
    Rgds
    Peter



  • You have to install the Qt SDK with the desktop MSVC2008 stuff, like you have.
    Which compiler was used for QtCreator doesn't hurt you :-)

    Then, additionally, you need the MSVC tool chain and perhaps the windows SDK.
    The MSVS2008 Express is not needed.


  • Moderators

    [quote author="Gerolf" date="1318853687"]
    Then, additionally, you need the MSVC tool chain and perhaps the windows SDK.
    The MSVS2008 Express is not needed.[/quote]
    This might need a minor correction. Since you like to compile with msvc2008 you need the msvc tool chain. This comes with msvc2008 Express version. The IDE of MSVC2008 Express you do not need, but probably you have to keep it installed. Otherwise your tool chain is gone as well.

    BTW Since you do not seem to have full MSVC2008, Qt Creator will provide a more seamless support for development with Qt.



  • OK, thanks for the information!
    But how do I "activate" the MSVC tool chain? I can see it under Tools->Options->Tool chains, but how do know I'm building MSVC binaries?

    When including <winscard.h> from the SDK (I'm using WDK, which should do I think) I get a zillion compile errors. I never get to the linking part of course...



  • perhaps, you have to add some includ edirectories, or linker paths.
    I never used winscard.h, sorry
    msvc tool chain should be active, if you select the MSVC qt version.



  • I've added include directories and linker paths...
    But how do I select MSVC qt version?


  • Moderators

    pelig: Check tools->options->tool chains: Is your MSVC listed there?

    If not, check your MSVC installation and "file a bug report":http://bugreports.qt.nokia.com/ giving details on the install location/windows version, etc.

    Assuming that the MSVC is detected, please check your Qt versions (Tools->Options->Qt4). Do you have one for that version of MSVC installed? If not: Install one.

    Check your project settings (Project mode->build settings, Qt Version): Is that the one for the MSVC version you are using? If not: Change it.

    Note: The Qt versions shipped with the Qt SDK are installed for the Qt Creator that is also part of the Qt SDK. Other Qt Creators will not autodetect those Qt versions and you will need to add those manually there if you want to use them.



  • [quote author="Tobias Hunger" date="1318865556"]pelig: Check tools->options->tool chains: Is your MSVC listed there?[/quote]Yep!

    [quote author="Tobias Hunger" date="1318865556"] Assuming that the MSVC is detected, please check your Qt versions (Tools->Options->Qt4). Do you have one for that version of MSVC installed? If not: Install one.[/quote]I have!

    [quote author="Tobias Hunger" date="1318865556"] Check your project settings (Project mode->build settings, Qt Version): Is that the one for the MSVC version you are using? If not: Change it.[/quote]Indeed it is!

    [quote author="Tobias Hunger" date="1318865556"] Note: The Qt versions shipped with the Qt SDK are installed for the Qt Creator that is also part of the Qt SDK. Other Qt Creators will not autodetect those Qt versions and you will need to add those manually there if you want to use them.[/quote]Guess that's OK since all stuff above is OK?

    The build steps (qmake and Make respectively) in the Build Settings are:

    • qmake: qmake.exe TextFinder.pro -f -spec win32-msvc2008
    • Make: jom.exe in <build path>

    Does that look OK?

    I also tried running qmake (as specified above) in command prompt but nothing happens. I switch on some warning flags, and it complains on the msvc files?
    @C:\work\TextFinder>qmake.exe -Wall TextFinder.pro -r -spec win32-msvc2008
    WARNING: Operator=(QMAKE_RCC) clears variables previously set: c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\features\qt_functions.prf:101
    WARNING: Operator=(QMAKE_UIC3) clears variables previously set: c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\features\qt_functions.prf:101@

    Am I doing something fundamentally wrong here?



  • Why do you use jom for make and not nmake, which comes with msvs?
    After running qmake in commandline, I would run nmake :-)



  • OK I forgot to run the jom.exe part:

    @c:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
    cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -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"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtCore" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtGui" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include" -I"......\WinDDK\7600.16385.1\inc\api" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\ActiveQt" -I"debug" -I"." -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\win32-msvc2008" -Fodebug\ @C:\Users\PETERL~1\AppData\Local\Temp\main.obj.1188.0.jom
    main.cpp
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stddef.h(44) : error C2065: 'In' : undeclared identifier
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stddef.h(44) : error C2144: syntax error : 'int' should be preceded by ')'
    [cut]
    C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtCore/qglobal.h(854) : error C2146: syntax error : missing ';' before identifier 'qlonglong'
    C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtCore/qglobal.h(855) : error C2146: syntax error : missing ';' before identifier 'qulonglong'
    [cut]@
    I get loads of errors in both MSVC2008 and Qt include files. Am I just missing some define flag?


  • Moderators

    You have an additional '-' in the command line after wchar_t. Is it a copy and paste problem?

    [quote author="pelig" date="1318922949"]
    @
    cl -c -nologo -Zm200 -Zc:wchar_t- -Zi ...
    @
    [/quote]



  • OK, I tried both 'nmake' and removing the hyphen after whar_t. Doesn't matter, same faults:
    @C:\data\qt-workspace\TextFinder>nmake
    Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    Copyright (C) Microsoft Corporation. All rights reserved.
    "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" -f Makefile.Debug
    Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    Copyright (C) Microsoft Corporation. All rights reserved.
    cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -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"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtCore" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtGui" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include" -I"......\WinDDK\7600.16385.1\inc\api" -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\ActiveQt" -I"debug" -I"." -I"......\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\win32-msvc2008" -Fodebug\ @C:\Users\PETERL~1\AppData\Local\Temp\nmBB0.tmp
    main.cpp
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stddef.h(44) : error C2065: 'In' : undeclared identifier
    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stddef.h(44) : error C2144: syntax error : 'int' should be preceded by ')'@
    And so on as previous posting. I'm running out of ideas here...



  • [quote author="Gerolf" date="1318922776"]Why do you use jom for make and not nmake, which comes with msvs?
    After running qmake in commandline, I would run nmake :-)[/quote]

    jom is a nmake compatible replacement. It adds support for multicore compilation (-jxx for reglar (gnu) make), which speeds up compilation time a lot :)



  • OK, thanks for the jom clarification. But I still can't build my project, with or without jom...


  • Moderators

    Concerning your question on missing define flags you have to have a look to stddef.h then. It might be dependend on the version you have.

    It is good that you have checked with nmake as well. Volker is right, jom speeds up things quite considerably. However, this is certainly not a problem for you yet. :-( However, in my experience there some times strange error messages because of serveral compilations in parallel with msvc. Those are not jom-related, but occur msvc IDE itself.



  • Solved!
    Well, at least I can build my Qt test project with Visual nmake/cl.exe.
    The problem was in the generated Makefile.Debug file.
    I created a test project in my installed Visual Studio 2008 Express and compared the MSVC build command with the qt Makefile build command. I then made following changes in the Makefile.Debug:

    • Removed alot of defines and added a few.
    • Changed include path from relative to absolute
    • Removed most include paths, just kept the necessary ones
    • Added a bunch of Windows static libs (kernel32.lib user32.lib just to mention a few)
    • Changed "-D" and "-I" to "/D" and "/I" for defines and include paths respectively. Dunno if that really is needed, but so it was in my MSVC project...

    The question is how to create the Makefile.Debug with qmake so it works from the start?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.