Where "-std=gnu++11" came from?



  • Hello everyone!
    Recently I built Qt 5.7 from source. Next I tried to build my application and was wonder because I saw some
    strange compiler flag during the building process. It is "-std=gnu++11". I didn't set this flag because use "-std=c++11" (or "-std=c++1z") flag.
    When I am compiling the application I see these flags together in the compile console. ("-std=gnu++11" and "-std=c++11")

    Can anyone explain what happens?
    How can I manage this behavior?

    I use OS X 10.11.5 and Clang compiler.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since 5.7 a C++11 capable compiler is required to build Qt.

    AFAIK, it's in the defaults of the CONFIG variable.



  • I use standard clang++ and clang compilers are delivered with latest Xcode version. The Qt library is built successfully without this issue. I suppose the problem inside the qmake utility for this version. I look into makefiles are generated for the Qt building and for my application. Qt's makefiles don't contain "-std=gnu++11", but makefiles for my application contain the flag.


  • Lifetime Qt Champion

    It comes from the mkspecs



  • @Alexander-Soplyakov said in Where "-std=gnu++11" came from?:

    Hello everyone!
    Recently I built Qt 5.7 from source. Next I tried to build my application and was wonder because I saw some
    strange compiler flag during the building process. It is "-std=gnu++11". I didn't set this flag because use "-std=c++11" (or "-std=c++1z") flag.
    When I am compiling the application I see these flags together in the compile console. ("-std=gnu++11" and "-std=c++11")

    Can anyone explain what happens?
    How can I manage this behavior?

    I use OS X 10.11.5 and Clang compiler.

    Did you find out why this happens? I get it on one computer (Mint 17.2) but not elsewhere (Fedora) ... extremely annoying, it errors out whenever a c++14 feature is used like std::make_unique. Argh!


  • Moderators

    @peter.karasev How do you set the C++ standard?
    It should be "CONFIG += c++11" for C++11 or "CONFIG += c++14" for C++14 in pro file.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.