Im not understand0ng

hey guys back again with anther question well i bought a book for 70$ on c++
and it use c++11 so when i use the code below it says

||=== Build: Debug in TheWorld2 (compiler: GNU GCC Compiler) ===|
C:\Users\Michael\Desktop\TheWorld2\main.cpp||In function 'int main()':|
C:\Users\Michael\Desktop\TheWorld2\main.cpp|10|warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]|
C:\Users\Michael\Desktop\TheWorld2\main.cpp|10|error: 'x' does not name a type|
C:\Users\Michael\Desktop\TheWorld2\main.cpp|12|error: 'x' was not declared in this scope|
||=== Build failed: 2 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|

and im using code blocks but im asking does this mean i need a new compiler or did i just make a stupid mistake???

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
auto x = 100;

cout << x << endl;

    return 0;
}
Last edited on
you need to tell codeblocks to use c++11
click settings
compiler
check the box that says
Have g++ follow the c++11 ISO c++ language standard [-std=c++11]
Last edited on
ty
Topic archived. No new replies allowed.