g++ is used by qmake and gcc is configured by the kit - qt

"/usr/bin/g++" is used by qmake, but "/usr/bin/gcc" is configured in the kit.
please update your kit of choose a mkspec for qmake that matches your target environment better.
couldn't find any way how to change the complier used by qmake to match the one configured by the kit.
one Tools > Options > Build & Run > kit . there is no way to change the qmake complier back to gcc. and the problem is there is only gcc and clang auto detected by qt 5.9

Tools->Options->build & run->compiler has the settings you need to fix that,
or add new kit, this my kit settings

The problem was that i installed Two versions of Qt and i think there config or something overlapped so the g++ option didn't appear until i remove both versions and installed Qt 5.9.1 again the g++ option appeared and now i don't have the issue any more .

Related

How to build clang compiler-rt on Windows linked against dynamic Visual C++ runtimes?

I want to use clang-cl with address sanitizers on Windows. When trying with the prebuilt llvm/clang packages from the official installers, I get linker errors because my application needs linking to the dynamic CRT (/MD) instead of the static CRT (/MT, the packages in the llvm/clang installers have compiler-rt built with this).
I want to use this with Qt, because I did not manage to build Qt itself with /MT .
According to these slides from a google engineer, building compiler-rt/asan with /MT is possible.
What do I have to change compared to these instructions when building llvm/clang in order to build compiler-rt with /MT ?
It turns out that my linker errors had another reason.
To find the required libraries, build a small hello-world app with the following command, inspect the resulting linker command and link to the required libraries explicitly:
clang-cl -v -fsanitize=address /MD test.cpp
PR35343 (currently unresolved) is about supporting automatic linking of sanitizer libs in lld-link, like it is done on other platforms.

How to create QT version for arm-linux-generic-elf-32

In my debian linux (with i386 processor).i installed QT creator thats works fine.Also i installed G++ cross compiler to run over another system which is having Debian linux with ARM processor.
Now in QT creator "Tools->Options->Build&Run-->Compilers" i added G++ compiler thats also using "Add" option that also fine.
Now in QT creator "Tools->Options->Build&Run-->Kits" i added new Kit with Name as "G++" , device type as "Desktop" , compiler as "G++ (above step added compiler)" thats also fine.
The problem here is in QT version option.In my QT version option having "QT 5.5.0 GCC 64bit" only. If i select that option it is showing the error because G++ compiler is "arm-linux-generic-elf-32 bit".
It is showing the error like , "The compiler G++ (arm-linux-generic-elf-32 bit) cannot produce code for the QT version QT 5.5.0 GCC 64bit (x86-linux-generic-elf-64bit)" .
For me the executable file only enough, no need to run on target directly.
Guide me how to add QT version for arm-linux-generic-elf-32bit
I had similar problem. Finally I found my mistake:
In menu:
QTCreator/Extras/Einstelungen/Compiler
(I guess it is QTCreator/Tools/Setting/Compiler in English.)
I clicked button Hinzufuegen ("Add") and then Benutzerdefiniert ("User defined") and that was wrong. It is to be: CCG!!!!!!!!!!!!!!!!!!!
Afterwards I had to set up also so called ABI to "arm-linux-generic-elf-32 bit"
Then I had a problem with Qt Versionen - it made its own and I could not delete it. So in "Kits" I inserted the new Qt Version.
It works somehow now...
Sort of crazy...
Select your custom kit, change Qt version to None. This is Windows screenshot, but it's same on Linux. If you have Qt version which config corresponds to your kit's compiller you can choose it instead None

Qt Creator 3.0.0/1 with Clang -> g++' is not recognized

Win 7 32, Qt Creator 3.0 and 3.1beta tried
I try to compile a project with Clang in Qt Creator. According to "Qt Creator and Clang" I have set PATH / LLVM_INSTALL_DIR .
LLVM was downloaded from here. http://llvm.org/releases/download.html . Settings in Qt Creator as shown below (screenshots). When I run qmake, I get 'g++' is not recognized as an internal or external command, operable program or batch file.
Do I miss something in the big picture? Do I need to install a special Qt version (compiled for Clang)? I have a Qt 5.2 for MSVC and Qt 5.2. for MinGw on my disk.
I have tried 3.1beta as this reads as CLANG is supported, maybe I understand it wrong.
Compiler settings in Creator:
Kit:
Clang for Win32 is not supported by the stock qmake environment. Anyway, you can follow this answer to get it work. After that specify the exact spec for generating Makefile:
qmake -spec win32-clang.

Cross-Compiling Qt Applications from Windows to Mac OS

Can anyone tell me how to build .app extension files through Qt Creator-SDK and MingW? GCC Compiler is also installed.
I have done is
qmake -spec macx-xcode project_name.pro
It created supporting files to create .app extension (when opened in Notepad).
Thank You.
I recommend CMake: it does what it says on the tin: cross-platform make. Integrates nicely with Qt (it's what KDE uses).

Changing compiler in Qt

How to change compiler (GCC) in Qt? I've installed GCC 4.4 and 4.6. At the momment Qt uses 4.4 but I'd like it to use 4.6. How to do it?
In the build sequence it may have a qmake command like qmake YourProject.pro -r -spec linux-g++-64 the choice of the tool chain is done in the spec file here linux-g++-64. Your will find this file in path-to-the-sdk/qt/mkspecs/linux-g++-64 (you get the concept right?)... If you open the spec file you will see that it includes the linux spec and the g++ spec.
One solution is to copy the g++ spec file and rename it g++-4.6 for example edit it and change :
QMAKE_CC = gcc
QMAKE_CXX = g++
to :
QMAKE_CC = gcc-4.6
QMAKE_CXX = g++-4.6
Idem for the linux-g++-64 it can be copied to linux-g++-4.6-64 and modify the include(...) command to include your new g++-4.6 file.
Finally build your project with qmake YourProject.pro -r -spec linux-g++-4.6-64.
I hope it's clear :) ...
I realise I am very late for the party but on Linux it is as simple as follows:
qmake -makefile <your-project.pro> -spec linux-clang
On my system, all sorts of different mkspecs are available at:
/usr/lib/x86_64-linux-gnu/qt5/mkspecs
Running make CC=my-custom-gcc CXX=my-custom-g++ LINK=my-custom-g++ seems to do the trick for me. But it might not be 100% safe (i.e. I wouldn't be surprised if running qmake with Linux specs and then specifying mingw32 compilers would fail).
If you are using Qt Creator 2.2.0, you can try Tools > Options > Tool Chains and then Add > MinGW.

Resources