Can't use c++17 features using g++ 7.2 in QtCreator

后端 未结 3 1925
既然无缘
既然无缘 2020-12-16 10:36

I have recently updated gcc and g++ to version 7.2. I would like to try out std::experimental::any and std::variant in particular, and I am using Q

3条回答
  •  情话喂你
    2020-12-16 11:25

    For Windows: I'm download qt-opensource-windows-x86-5.11.1, icncluded MinGW32. For MinGW64 I'm download qt-5.5.0-x64-mingw510r0-seh-rev0 and install only compiler. Configure QtCreator, as says here. Create new project and add QMAKE_CXXFLAGS += -std=gnu++1z to .pro file (gcc doc). For test, try compile this simple code:

    #include 
    
    std::optional foo() 
    {
        return std::nullopt;
    }
    
    int main(int argc, char *argv[])
    {
        foo();
    }
    

提交回复
热议问题