How to use QTcreator with the Visual Studios novem

2019-06-03 17:20发布

问题:

I've been struggling with this for a few days now. I can't figure out how to set up QT to use the cpt compiler. I've used a program called BlueGo (https://bitbucket.org/Vertexwahn/bluego) to compile Qt with VS2012, and I can use that version with QtCreator np. I can use the nonupdated VS2012-compiler with it, but I can't set up the ctp-compiler, it just gives me an error that it's unable to use the compiler. It doesn't detect it automatically so I'll have to add it as a custom compiler. I don't understand half of those settings lol :).

回答1:

  • In C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat
    1. just after the line:
      @set PATH=%VCINSTALLDIR%BIN\x86_amd64;%PATH%
      insert:
      @if exist "%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\BIN\x86_amd64" set PATH=%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\BIN\x86_amd64;%PATH%
    2. just after the line:
      @set INCLUDE=%VCINSTALLDIR%INCLUDE;%INCLUDE%
      insert:
      @if exist "%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\INCLUDE" set INCLUDE=%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\INCLUDE;%INCLUDE%
  • In C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat
    1. just after the line:
      @if exist "%VCINSTALLDIR%BIN" set PATH=%VCINSTALLDIR%BIN;%PATH%
      insert:
      @if exist "%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\BIN" set PATH=%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\BIN;%PATH%
    2. just after the line:
      @if exist "%VCINSTALLDIR%INCLUDE" set INCLUDE=%VCINSTALLDIR%INCLUDE;%INCLUDE%
      insert:
      @if exist "%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\INCLUDE" set INCLUDE=%VCINSTALLDIR%..\..\Microsoft Visual C++ Compiler Nov 2012 CTP\INCLUDE;%INCLUDE%

This simple solution allows Qt Creator (and other tools, that relies on vcvarsall.bat) to use VS2012 NOV CTP instead of default one. Remember: To revert back to the default compiler you should remove these inserted lines!