QtCreator (qmake and cmake based projects) is not using by default the compilers from E-ELT, which is devtoolset-7 lua module. We should force Qt either to use WAF, or to use those binaries as compilers.
Understanding the situation
Devenv virtual machines include two set of compilers. The ones that comes with the default CentOS 7.4 installation (GCC 4.9), and the ones used to compile software for E-ELT (GCC 7).
The default CentOS ones are installed in the standard path (/usr/bin). The ones for E-ELT are installed by NIX in /opt/rh/devtoolset-7.
When using LUA modules (module load gcc7), it will only set environment variables for CC, CXX, AR, LD.
QtCreator does not use these environment variable to figure out its compilers. It searches in the PATH for known compilers it supports. Since E-ELT compilers (gcc7) are not in the PATH, then it fails to find them.
WAF is not a supported build system by QtCreator. But Qt Creator allows us to set custom building and run procedures. WAF is very much self-contained, so it is easy to integrate it into QtCreator.
NOTE: This section “Kit Configuration” is only needed if you want to compile things without using WAF. Since WAF is in charge of doing the proper compiler and linker calls, Qt Creator (when using WAF) will never need to know the real Compiler.
On the other hand, if you just want to do a quick Qt example (without using WAF), then you will need to set this, because it would be then qmake or cmake the ones making the calls to the compiler and linker. There is no harm in doing this when using WAF.
To allow Qt to find the compilers used by WAF, use:
$ PATH=/opt/rh/devtoolset-7/root/bin:$PATH qtcreator.sh
Then click on “Manage Kits…” button (circled in red in the screenshot). A new dialog window will open called “Options” and click the Auto-detected “Desktop Qt” kit.
- In the “C” compiler select the option “GCC (C, x86, 64 Bit in /opt/rh/devtoolset-7/root/bin)”
- In the “C++” compiler select the option “GCC (C++, x86, 64 Bit in /opt/rh/devtoolset-7/root/bin)”
In the “Debugger” compiler select the option “System GDB at /opt/rh/devtoolset-7/root/bin/gdb”
Click on the “Ok” button, in the lower-right set of buttons in the dialog window “Options”.