I recently tried to use Qt Creator 1.3.2, Qt 4.6.2, and GCC 4.4.0 (32-bit version) on Windows 7 (64-bit) to compile an application using some of the experimental C++0x extensions and encountered the following (fatal) error:
This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
In my search for a solution, I came across the thread qmake and compiler flags?, and added the following to the .pro file:
CXXFLAGS += -std=c++0x
but that didn't seem to make a difference.
So, I expect there's some tag I need to add to the .pro (project) file, but I've never messed with the GCC compiler switches in Qt, QMake, and QtCreator before, and I am uncertain about the proper invokation / incantation. So, my question is how do you set GCC compiler switches when using QtCreator, QMake, and Qt?
Click Tools > Options. Select Build & Run from the list at the left. In the right pane, select the Compilers tab. Click Add and select GCC > C++ from the drop-down menu to add a new C++ native compiler.
qmake was created by Trolltech (now The Qt Company). It is distributed and integrated with the Qt application framework, and automates the creation of moc (meta object compiler) and rcc (resource compiler) sources, which are used in Qt's meta-object system and in the integration of binary resources (e.g., pictures).
Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux. On Windows it can use MinGW or MSVC with the default install and can also use Microsoft Console Debugger when compiled from source code. Clang is also supported.
It boils down to reading the manual. Instead of using CXXFLAGS
in the .pro file, you need to use QMAKE_CXXFLAGS
as in:
main.cpp:
#include <cinttypes> int main() { return 0; }
main.pro:
SOURCES += main.cpp QMAKE_CXXFLAGS += -std=c++0x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With