Qt World Summit: Submit your Presentation

qmake substituting c++14 with c++1

  • I'm using Qt Creator 3.3.2 to build a c++ project. I'm using clang 3.5 and the std lib that comes with gcc 4.9. In the qmake project file I've added the line CONFIG += c++14. In the resulting makefile it says -std=c++11 however, and my program will not compile. If I manually edit the makefile to -std=c++14 everything works as expected.
    This is ok, but sometimes the makefile will be overwritten by changes to my project layout and I have to edit it again. Is there a way around this?

  • Should work with qmake from Qt 5.4.0 or higher...

  • @B_old Take a look on the directory Qt/5.4/clang/mkspecs/common. It contains qmake base configuration files for various compilers.
    You can set QMAKE_CXXFLAGS_CXX11 = -std=c++14 in clang.conf to make a qmake to generate a Makefile with c++14.

  • Under Qt/5.4/ I only see android_armv7 and gcc_64. I think I installed clang after Qt. Could that be the reason?

  • @B_old Could you solve the issue in the meantime?

  • Unfortunately not. I basically gave up when I found out that the clang config seems to be missing. In practice I don't have to touch the makefile very often.

  • @B_old
    There is a clang conf file Qt/5.4/gcc_64/mkspecs/common/clang.conf that contains QMAKE_CXXFLAGS_CXX11 = -std=c++11 try to change it c++14

  • Ah, now I found it. Your suggestions also solved the problem! Thanks for the help.

Log in to reply