C++11 Geany setup

南楼画角 提交于 2021-02-07 12:44:13

问题


I am learning C++ and I need to properly setup my compile and build commands in Geany for C++11.

I thought I had them correct, but when using auto, I receive the following error:

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

Here are my current set build commands:

Compile:  g++ -Wall -c "%f"
Build:  g++ -Wall -o "%e" "%f"
Execute:  "./%e"

What do I need to set these to in order to properly compile, build, and execute a C++11 program?


回答1:


As what is pointed out in the comments, you need to add the flag -std=c++0x. You can set it in the "Build" -> "Set build commands", then modify the commands in following boxs:

Compile:

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

Build:

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


来源:https://stackoverflow.com/questions/14544325/c11-geany-setup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!