7

I want to add the MSVC 2017 compiler correctly inside my Qt 5.13, I know where to add it! But, don't know : "How to? What is required to be filled inside the add compiler's menu?"

I have tried too many things. I have a long long story with Qt's main problem! My main problem is : "module machine type 'x64' conflicts with target machine 'x86'" which appears in the console when I build the Qt application! I am going to include some of the things that I have tried :

  • Tried to build from the Qt app and the Console.
  • Tried all the compilers that are auto-detected from Qt. There are more, but no need to mention the rest. On my default kits, Most of the names were in this order : "Qt 5.13.0 for UWP 64/86-bits (MSVC 2017)". I thought that it must be MSVC 2017, so I tried to setup MSVC 2017 (I have MSVC 2019). I found the compiler's main program which is : "cl.exe". I went to Qt auto-detected compilers, I did not find it! I tried to add it by copying the commands for qmake.exe and jom.exe from another kits that already made for me. However, I put the compiler's type 'custom', because I did not find MSVC. Is that wrong, and what does that differ from the other types?

My next thing to fix (actually try) is this :

Image

The picture above contains the compiler's path and Make's path. I need to find the Make path tool, I think it is required, isn't it? I tried to run the program without Make step, ONLY qmake step. Which led me into another problem when running the program : "An Error has Occured when trying to Build/Deploy your program". I filled the compiler's path correctly, but I don't know how to fill the make path, I don't even know what is make path. Note that Qt is not giving me any result because the make path is not filled correctly!

I hope that everything is described and all the information that you need is already included in the story above!

4
  • From the error message, it looks like you're trying to link a 64-bit library into a 32-bit executable. Check your solution configuration! Jul 4, 2019 at 11:56
  • in ABI you selected x86 but your compiler is in x64 folder. Change ABI to x64. Jul 4, 2019 at 12:53
  • @Georgy Pashkov , solution configuration? if you mean solution configuration inside Visual Studio, uhm it has no relation with that I think. But If you mean something else, then enlighten me. Jul 4, 2019 at 15:32
  • @Amazonasmann . I will give you a pic of the compilers that are auto-detected : imgur.com/a/J0TCOD4 . None of them are x64 explicitly. All I am thinking about is I don't have an appropriate compiler for Qt 13, this is why I installed MSVC 2017. Jul 4, 2019 at 15:39

3 Answers 3

7

You cannot add MSVC manually to Qt Creator. You do need to have it auto-detected.

Also the mechanisms of detection changes depending on MSVC version and Qt Creator version. So be sure to use the latest version of Qt Creator (4.9.2 at this time) to make sure all your installed MSVC toolchain are detected.

Also given you comment you seem to confuse 64-bit and 32-bit.

x86 means 32-bit and amd64 means 64-bit.

This gives:

  • x86 32-bit compiler that produces 32-bit exe
  • x86_amd64 32-bit compiler that produces 64-bit exe
  • amd64 64-bit compiler that produces 64-bit exe
  • amd_x86 64-bit compiler that produces 32-bit exe

So if you wan to produce 32-bit programs, you can use x86 or amd64_x86. If you want to produce 64-bit programs, you can use amd64 or x86_amd64.

If at some point you want to compile a Qt porgam, but Qt Creator does not recognize your MSVC toolchain, you still have a solution:

  1. Open Qt 5.12.4 (MSVC 2017 64-bit) from the start menu
  2. In the prompt run C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat amd64
  3. Run qmake and enjoy
2
  • Thank you very much. you helped me a lot to understand what is happening! But I have one more thing to ask if you don't mind me. I used qmake to generate a Makefile. how do I use qmake to produce a usable program (".exe") please? Jul 5, 2019 at 13:16
  • @hassan1551 You use one of the available "make" program. If you are using MSVC the default one is to use nmake, but Qt offers a replacement called jom in: C:\Qt\Tools\QtCreator\bin\jom.exe.
    – Benjamin T
    Jul 5, 2019 at 13:21
2

You can't manually add MSVC to Qt Creator. If you want to use it make sure to have the correct Visual Studio version installed.

I suggest reinstalling Visual Studio if the MSVC compiler don't appear in the Compilers tab.

1
  • Agree! I had tried many things before installing Visual Studio. None of them worked. Jul 27, 2020 at 2:57
0

For me, this issue is solved by QT Maintenance Tool.

enter image description here

Run the Tool, choose "Add a component", and check the component for your specific QT version. Then install the component and the issue is fixed.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.