Using Clang configured with MSVC 2017 on Windows with QtCreator 4.3.1



  • Hi,

    I've been trying to build my Qt application using Clang.
    It worked fine (mostly) while I was using it alongside MSVC 2015's standard library (by simply using the auto-detected "LLVM 64bit based on MSVC2015" compiler), however, I would like to use some of the new C++17 headers that were shipped with MSVC 2017 only.

    QtCreator does detect my installation of LLVM/Clang 3.9.1, but it insists on using it configured based on MSVC 2015, and I can't find a way to switch it to be based on MSVC 2017.

    I have desperatly been trying to manually add some compiler configuration that would allow me to do such a thing, but it seems that I can not set up the build environment properly.

    For instance, if my understanding is correct, MSVC ships a script called vcvarsall.bat to set all the build environment variables necessary, but I can't see any option in the manual configuration for a Clang compiler (or a custom compiler for that matter) to call that script. Even though the auto-detected LLVM clearly knows this script and uses the MSVC 2015 version of it!

    0_1499339785493_Qt_MSVC14_LLVM.jpg

    I would like to avoid manually changing the build environment variables (mostly the include and lib paths for the standard library) for each of my projects, if at all possible.

    NB: I also have installed Qt 5.9 binaries built with MSVC2017, and it builds fine with MSVC.

    I am quite puzzled by this issue, so if anyone can point me in the right direction, it would be very much appreciated!



  • Hi,

    I know that my reply is very late bu I have been using QtCreator with clang and vs2017 without problems.
    The way to do this is that first you need to run this script in a command prompt then start QtCreator within the same command prompt window
    that way Clang will be able to see all the header files and you will be able to create a new kit based on whatever clang version you are having.
    also note that you would most probably need to add clang manually as a c and c++ compiler plus creating a new kit based on that.
    finally in the created kit make sure that you use "win32-clang-msvc" as your mkspecs under "Qt mkspec" in the kit tab.

    Hope that helps.


Log in to reply
 

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