我有以下程序。g ++ - 警告:扩展的初始值设定项列表仅在-std = C++ 11或-std = gnu ++时可用11
#include <iostream>
#include <string>
int main() {
int i {0};
std::string str {"Hello World"};
std::cout << i << " : " << str << std::endl;
return 0;
}
当我用g ++编译这个时,我得到了下面的错误。 我正在使用g ++ 5.4。 g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
警告:仅可扩展初始化列表-std = C++ 11或-std = GNU ++ 11
我想知道什么是g++
编译程序的标准方法使用std::C++14
和必要的标志。
在此先感谢。
更新:
我已经与以下做到了:g++ ./ex01.cpp -o ex01.out -std=c++14 -Wall -o2
* “我在C++完全小白” *不原谅你无法谷歌的东西。 – LogicStuff