簡體   English   中英

-std = c ++ 11在g ++命令行中的位置

[英]Position of -std=c++11 in g++ command line

我只是好奇標准選擇開關的位置(對於我的情況是-std=c++11 )在g ++命令行中是否有意義。 原因如下:

g++   -ftest-coverage -fprofile-arcs -std=c++11 
      -ansi -fpermissive -finline-functions -Wno-long-long
      -fvisibility-inlines-hidden -m64 -Wall -Wextra 
      -g -o CMakeFiles/common.dir/cryptoclass.cpp.o 
      -c /home/work/common/cryptoclass.cpp

不編譯,而以下內容:

g++   -ftest-coverage -fprofile-arcs
      -ansi -fpermissive -finline-functions -Wno-long-long
      -fvisibility-inlines-hidden -m64 -Wall -Wextra 
      -g -o CMakeFiles/common.dir/cryptoclass.cpp.o 
      -std=c++11  -c /home/work/common/cryptoclass.cpp

確實可以編譯。 唯一的變化是-std=c++11已移至開關的末尾。

g ++發出以下警告:

error: #error This file requires compiler and 
       library support for the ISO C++ 2011 standard. 
       This support is currently experimental, and must 
       be enabled with the -std=c++11 or -std=gnu++11 compiler options.

版:

g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

根據文檔-ansi選項啟用c ++-98 / c ++-03標准。

如果設置多個標准選項,則后一個選項將覆蓋前一個選項。 同樣適用於其他互斥選項,例如優化級別。

暫無
暫無

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

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