Using Clang with Qt on Windows



  • I've installed Qt SDK with Qt Creator on my Windows 7. LLVM & Clang installed as well. CMake was already installed. Afterwards added Clang as a compiler into: Tools -> Options... -> Build & Run -> Compilers

    Then I've created Clang kit. However while creating new project (simple console application) I've no ability to choose Clang kit. There are only autodetected MSVC kits.

    What I've missed and how should I use Clang with Qt?



  • Hi,

    Did you check whether the clang kit was fully configured?
    Also, you probably need a qt libraries compiled with clang for this to work, do you have those? I can't recall whether they are available or not.



  • @t3685 It seems that you're right - there is an empty "Qt version" field in Clang kit. To add this I need some qmake (don't know which).
    I haven't compiled anything. Why this should be done: Qt already have compiled dlls? Could you give some documentation for this - it would be great to understand the point.
    Thank you for help!



  • Hi,

    The qmake exe can be found in the Qt install folder of the SDK. From your answer I am assuming you don't have a lot of experience with C++. C++ applications can only use libraries built with the same compiler as the application. In your case you want to use clang so you need Qt libraries compiled with clang.
    Qt provides a number of versions of SDK for different compilers. You need to make sure that you downloaded the right one - if it exists.

    Greetings,

    t3685


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    There's no pre-built package for Clang on Windows. I don't know if it would even be compatible with the MinGW version of Qt.

    So if you'd like to avoid Visual Studio, just download the MinGW Qt version. It's provided with MinGW so you don't have to download it from somewhere else.



  • Yes, I'm newbie in C++ and didn't know the problem with different libraries and compilers. Now it is clear. Thank you very much!


Log in to reply
 

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