[Solved] Qt creator doesn't compile with MVSC



  • Hi, Could you please help me to setup step by step Qt creator to compile with MSVC compiler? I need to integrate an external API which supports only MSVC compilers and I'm struggling with it.
    My knowledge of compilation is low, and there's nothing clear (at least for me) on the internet.
    I have installed MSVC 2013 + the Qt Add-in for MSVC.
    In Qt > Tools > Options > Build & Run, I have selected MVC++ Compiler 12.0(x86) instead of MinGW.
    I have setup two new environment variables, QTDIR & QMAKESTEP:
    http://img11.hostingpics.net/pics/868264enVar.png
    I have edited the PATH Variable to add this:
    http://img11.hostingpics.net/pics/511359enVarPath.png

    But it says there is not debugger setup:
    http://img11.hostingpics.net/pics/404071debugger.png

    And when trying to build (after running qMake), it shows the following message:
    http://img11.hostingpics.net/pics/270722errorMsg.png

    And line 711 is the following:
    C:\Qt\Qt5.5.0\5.5\msvc2013_64\bin\moc.exe $(DEFINES) -D_MSC_VER=1800 -D_WIN32 -D_WIN64 -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/mkspecs/win32-msvc2013 -I//londc1/homes$/azzouz/GRM_DM -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/ActiveQt -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtWidgets -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtGui -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtANGLE -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtSql -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtCore -I. ..\GRM_DM\mainwindow.h -o debug\moc_mainwindow.cpp

    Can you help me please?



  • Hi Reezeus ,

    Try this.

    Set Qt Dir : C:\Qt\5.5\msvc2013_64
    Path : C:\Qt\5.5\msvc2013_64\bin



  • Hi N.Sumi

    Thanks.

    I have changed the path:
    http://img11.hostingpics.net/pics/544654enVar2.png
    http://img11.hostingpics.net/pics/862774enVar3.png
    But nothing changed. Actually those paths don't even exist in my C:\Qt folder:
    http://img11.hostingpics.net/pics/997416QtFolder.png



  • hi,

    I don't know, why you Qt folder looks differently. Please check the path.I am confused little bit, have you kept Qt5.5 in the Qt 5.4? I prefer copy the Qt5.5 separately out side Qt5.4. In Qt 5.5, you will have mvsc 2012 & mvsc2013_64. Make path to mvsc2013_64. Can I know the package , actually you are using.

    Qt Open source installation: http://www.qt.io/download-open-source/#section-2 (for you, windows host: Qt 5.5.0 for Windows 64-bit (VS 2013, 650 MB)
    http://www.qt.io/download-open-source/





  • I'm using Qt 5.5 now. I was working with version 5.4 but this morning I uninstalled it, downloaded the open source package "Qt 5.5.0 for Windows 64-bit (VS 2013, 650 MB) " and installed it (just a try when you are desperate...); and so the Qt installed in this folder:
    http://img11.hostingpics.net/pics/612927QtFolder1.png

    And here are the subfolders:
    http://img11.hostingpics.net/pics/158005QtFolder2.png
    http://img11.hostingpics.net/pics/776405QtFolder3.png
    http://img11.hostingpics.net/pics/238824QtFolder4.png



  • okay..
    If you are using Qt5.5 now, then the path is

    Set Qt Dir : C:\Qt\QT5.5.0\5.5\msvc2013_64
    Path : C:\Qt\QT5.5.0\5.5\msvc2013_64\bin



  • Done, but nothing changed. I have run qmake again then try to build but it shows the same error message, at the same line of the Makefile.


  • Moderators

    Hi @reezeus,

    I have installed MSVC 2013 + the Qt Add-in for MSVC.

    If you use Qt Creator as your IDE, then you don't need the Add-In. That's only for people who want to use Visual Studio as their IDE.

    Uninstall the Visual Studio Add-In.

    I have setup two new environment variables, QTDIR & QMAKESTEP:
    http://img11.hostingpics.net/pics/868264enVar.png
    I have edited the PATH Variable to add this:
    http://img11.hostingpics.net/pics/511359enVarPath.png

    Remove these. They are not necessary, and they can cause problems.

    You don't need to set QTDIR or QMAKESPEC. You also don't need to add Qt to your PATH.

    But it says there is not debugger setup:
    http://img11.hostingpics.net/pics/404071debugger.png

    Download and install Debugging Tools for Windows from the Microsoft website.

    (Note: A debugger is very useful, but it's not strictly necessary. You can build and run programs without a debugger.)

    And when trying to build (after running qMake), it shows the following message:
    http://img11.hostingpics.net/pics/270722errorMsg.png

    And line 711 is the following:
    C:\Qt\Qt5.5.0\5.5\msvc2013_64\bin\moc.exe $(DEFINES) -D_MSC_VER=1800 -D_WIN32 -D_WIN64 -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/mkspecs/win32-msvc2013 -I//londc1/homes$/azzouz/GRM_DM -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/ActiveQt -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtWidgets -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtGui -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtANGLE -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtSql -IC:/Qt/Qt5.5.0/5.5/msvc2013_64/include/QtCore -I. ..\GRM_DM\mainwindow.h -o debug\moc_mainwindow.cpp

    I think the Makefile reader doesn't like the '$' in your folder name (homes$). Move your files to a different folder (which doesn't have '$' in its name) and try again.



  • Hi JKSH

    Thanks for your advices. I followed everything (deleting Paths, uninstall MVSC add-in and install Debugging tool for windows which is now recognized by Qt creator).
    I have then created a new project and locate it in another drive/folder where there's no dollar sign (folder in the desktop basically).
    the debugger doesn't show the error message relative to the Makefile, but it throws lots of errors (All the same) saying it cannot find my .obj files:
    http://img11.hostingpics.net/pics/804880errorObjFiles.png

    the "imp_blpapi_Event_release" things relate to the bloomberg API I'm using. However the file not found (and all the others) relate to class that I have written, like "workerIndexData" in the screenshot.

    I have checked the forum before posting, there's an accepted answer that suggests to clear manually the folder "build-GRM_DMGT-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug", then run qmake again and rebuild. I've done this but it doesn't change anything.


  • Moderators

    You're welcome :)

    @reezeus said:

    it throws lots of errors (All the same) saying it cannot find my .obj files:

    Ok, that means your compilation finished successfully, but the next step (linking) failed.

    Those message don't mean that the system can't find your .obj files. Instead, it means that your .obj files need to access functions/variables from your Bloomberg library (these are the "external symbols"), but the system can't find your Bloomberg library.

    In your .pro file, you must specify where to find your Bloomberg library. Add a line like this: LIBS += "C:/Path/to/Bloomberg/bloomberg.lib"



  • Well, I've been struggling to find the correct syntax because I was specifying the path of the folder containing the Object File Library instead of the path to the file directly...
    I have added this to the .pro file:
    LIBS += "Z:/.../C++API/v3.8.18.1/lib/blpapi3_64.lib"
    And suddenly it seemed to work.
    But Qt creator asked me to setup debugging symbols for windows (I assume it recognized I was using a new debugger for the first time), I say yes and then it crashed with an error message "The CDB process terminated".
    The problem is that now it happens every time I start debugging, without even a message in the debugging window, it appears as soon as I press F5.



  • In fact I can't even run the app, the output tab shows this immediately after Ctrl + R:
    Starting C:...\QtProjects\GRM_DMGT\build-GRM_DMGT-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\debug\GRM_DMGT.exe...
    The program has unexpectedly finished.
    C:...\QtProjects\GRM_DMGT\build-GRM_DMGT-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\debug\GRM_DMGT.exe crashed


  • Moderators

    @reezeus said:

    And suddenly it seemed to work.

    Good to hear!

    But Qt creator asked me to setup debugging symbols for windows (I assume it recognized I was using a new debugger for the first time), I say yes and then it crashed with an error message "The CDB process terminated".
    The problem is that now it happens every time I start debugging, without even a message in the debugging window, it appears as soon as I press F5.

    Hmm... I don't have experience with CDB, so I can't help you here, sorry. (I use MinGW + GDB most of the time)

    @reezeus said:

    In fact I can't even run the app, the output tab shows this immediately after Ctrl + R:
    Starting C:...\QtProjects\GRM_DMGT\build-GRM_DMGT-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\debug\GRM_DMGT.exe...
    The program has unexpectedly finished.
    C:...\QtProjects\GRM_DMGT\build-GRM_DMGT-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\debug\GRM_DMGT.exe crashed

    The crash could be caused by many things, for example:

    1. A bug in your code, OR
    2. A bug in the Bloomberg library, OR
      3, Incompatible libraries/DLLs

    What version of MSVC was the Bloomberg library built with? (Note: Different versions of MSVC are not compatible with each other. If the Bloomberg library was built with MSVC 2010, then you must also use the MSVC 2010 version of Qt)



  • Hi JKSH

    I haven't checked the forum this week end, just saw your message.
    Actually I find it out, although the solution doesn't make full sense for me:
    When adding the external library using the Qt tool, I had ticked "Add 'd' suffix for debug version", which I believed was the thing to do since I work in debug mode and not release mode.
    Now everything is fine, I have finally (!!) managed to compile The Bloomberg library within Qt creator.
    Thanks a LOT for your help and patience, It is really good to have people like you to help people like me on this forum, especially because your also the one who guided me on my previous post, when I asked how to integrate the Bloomberg library... I thought this would be straight forward... :)
    Cheers


Log in to reply
 

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