Qt Creator using Visual Studio compiler



  • I am new to Qt and have almost no knowledge of Visual Studio. I have a specific need to start making some sort of progress with a vital project.

    It looks like Qt is the perfect tool for my Windows project. I have downloaded and installed Qt 5.2.1 which installed Qt Creator 3.1.0. According to the About window Qt Creator was compiled using MSVC 2010, 32 bit.

    I have a 3rd party API that I am using that was also compiled using MSVC 2010. It came with some Qt sample programs and I have been trying to get the samples running using Qt Creator. But I am getting tons of errors. It ends up those samples were created using the Qt add-in to MSVC 2010 Pro. I contacted the vendor and they said it should work if I use the VS 2010 express compiler from Qt Creator.

    I do not have access to VS 2010 Pro and express does not allow plug-ins. So using the Qt add-in is not an option. I am trying to set up Qt Creator to use the VS 2010 Express compiler.

    After installing VS 2010 Express if I go to Tools > Options and go to the Compilers list it does show that it has detected the MSVC Compiler. But I can't figure out how to tell Qt Creator to use that compiler for my project.

    I have searched for days. The answer is probably in the forums somewhere but I can't find a single basic set of instructions on how to do this. Can someone please help?

    [Edited: Please write "Qt", not "QT". "QT" stands for Apple QuickTime. -- JKSH]


  • Moderators

    Hi, and welcome to the Qt Dev Net!

    [quote]I have downloaded and installed QT 5.2.1 which installed QT Creator 3.1.0. According to the About window QT Creator was compiled using MSVC 2010, 32 bit.[/quote]That tells us that the Qt Creator IDE has been compiled using MSVC 2010. However, that doesn't tell us which compiler your Qt libraries use.

    To find out, see Tools -> Options... -> Build & Run -> Qt Versions. The compiler mentioned here is the one your Qt libraries need. If it's not MSVC 2010, then you have downloaded the wrong package.

    (Note: Qt Creator is simply another program that was written with Qt)



  • When you say "your Qt libraries" are you talking about my 3rd party libraries? If so, they were built using MSVC 2010. When I try to build the sample program using MinGW I get hundreds of undefined references within the 3rd party API. They are saying that is because my code must be compiled using MSVC 2010.

    When I go to the B&R > Qt Versions window all I see is the MinGW option. In the Compilers window it does acknowledge the MSVC 2010 compiler of the Visual Studio 2010 Express package I installed this morning. But I don't see a way of telling Qt Creator to use that compiler instead of MinGW.

    When I try searching, all I see is how to compile the Qt source using MSVC 2010. I'm not worried about compiling Qt, just my own code using the MSVC compiler from Creator so that it can utilize the 3rd party API properly.


  • Lifetime Qt Champion

    Hi,

    No JKSH means the Qt libraries you just installed.

    So from what you wrote, you have installed the MinGW build of Qt. If you want to compile your application/libraries using MSVC2010 then you need to install the MSVC2010 version of Qt


  • Moderators

    [quote author="gpuckett54" date="1398453109"]When you say "your Qt libraries" are you talking about my 3rd party libraries?[/quote]I meant Qt.

    Your 3rd-party library is a C++ library. Qt is also a C++ library.

    From what you've told us,

    • Your 3rd-party library was compiled using MSVC 2010, but
    • Your Qt library was compiled using MinGW.

    These are incompatible -- that's why you get errors.

    [quote]They are saying that is because my code must be compiled using MSVC 2010.[/quote]Correct. And to do that, you need to download a version of Qt that has been compiled using MSVC 2010.

    Uninstall your current copy of Qt. Then, go to http://qt-project.org/downloads, click "Show downloads", and download "Qt 5.2.1 for Windows 32-bit (VS 2010, 518 MB)".

    (I presume your 3rd-party library is 32-bit?)

    [quote]But I don't see a way of telling Qt Creator to use that compiler instead of MinGW.[/quote]Qt Creator has some safety features here. It won't let you combine the MSVC 2010 compiler with your MinGW-based Qt.



  • I totally missed that option. I just downloaded from the first option that offered a Windows based install. I have removed the MinGW version and installed the VS2010 version. Thank you for helping me out.

    Now I have other issues to get things working. I will ask in another thread. I think this solved my initial issue.



  • @JKSH This was very helpful. I have to add though that I had to download debugger separately because Qt did not recognize MSVC debugger automatically.


  • Lifetime Qt Champion

    @Adil that's not a detection problem. Visual Studio's debugger is not available to outside applications.



  • @SGaist Got it. Thanks for explanation!


Log in to reply
 

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