8

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?

asheeshr
  • 4,088
  • 6
  • 31
  • 50
mcd
  • 6,446
  • 9
  • 27
  • 32
  • 3
    I think you need to compile under the c++11 standard, using a compile flag something like `-std=c++11`. – Waleed Khan Jan 27 '13 at 04:14
  • Try `-std=c++0x` option to gcc. – n. m. could be an AI Jan 27 '13 at 04:15
  • 1
    Whether you should use `-std=c++0x` or `-std=c++11` will depend on your gcc version. The `c++11` variant was added in gcc 4.7 but I believe the old `c++0x` will continue to work. To determine your gcc version simply use `gcc --version`. – Ze Blob Jan 28 '13 at 03:58

1 Answers1

11

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"
unsym
  • 2,080
  • 1
  • 20
  • 19