簡體   English   中英

g ++-警告:擴展的初始化程序列表僅在-std = c ++ 11或-std = gnu ++ 11中可用

[英]g++ - warning: extended initializer lists only available with -std=c++11 or -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中可用

我想知道使用帶有必要標志的std::C++14g++編譯程序的標准方法是什么。

提前致謝。

更新:

我已經完成以下操作: g++ ./ex01.cpp -o ex01.out -std=c++14 -Wall -o2

用標志編譯:

-std=c++14

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM