简体   繁体   中英

GCC Compiler Warning: extended initializer lists only available with c++0x

Using this member initialization...

StatsScreen::StatsScreen( GameState::State level )
    : m_Level( level ) {
  ...//
}

I get the following warning...

extended initializer lists only available with -std=c++0x or -std=gnu++0x

Any information regarding this warning?

Edit: Warning went away after I removed one of the member that was assigned to a value inside the constructor (couldn't be done through member initialization) and made it a local variable instead of a class member. Still want to know what that warnings means though.

I think you are initializing the object with {...} instead of (...) :

StatsScreen ss{...}; // only available in C++0x
StatsScreen ss(...); // OK in C++98

To compile your code as C++0x code, just add the following flag when compiling:

g++ test.cpp -std=c++0x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM