C++11 吉尼设置

C++11 Geany setup

本文关键字:设置 C++11      更新时间:2023-10-16

我正在学习C++,我需要在 Geany 中正确设置 C++11 的编译和构建命令。

以为我是正确的,但是在使用auto时,我收到以下错误:

warning: ‘auto’ will change meaning in C++0x; please remove it [-Wc++0x-compat]

以下是我当前设置的构建命令:

Compile:  g++ -Wall -c "%f"
Build:  g++ -Wall -o "%e" "%f"
Execute:  "./%e"
我需要设置

这些内容才能正确编译、构建和执行 C++11 程序?

正如评论中指出的那样,您需要添加标志-std=c++0x。您可以在"构建"->"设置构建命令"中进行设置,然后在以下框中修改命令:

编译:

g++ -Wall -std=c++0x -c "%f"

建:

g++ -Wall -std=c++0x -o "%e" "%f"