Can someone explain this please

closed account (EwCjE3v7)
Hi there,
Why do i get this error for auto, i am reading c++ primer 5th edition with is rewritten for c++11 and i get this? thanks

1
2
3
4
5
6
7
8
  #include <iostream>

int main()
{
    int i = 0, &r = i;
    auto a = r;
    return 0;
}

error: auto changed meaning in C++11


Edit:
FIXED IT!
Just tick -std=c++11 in codeblocks by Setting Compiler and check the box
sry should have done more research before posting
Last edited on
Interesting, I just placed the code in my IDE (VS2012 November 2012 CTP) and it worked perfectly fine.. Can we get information of what environment you are in?

edit: Good! Thanks posting your solution!
Last edited on
closed account (EwCjE3v7)
I don't know what the problem was but after some research I tried this and it worked. I'm using Mingw.
And thanks for the reply :).
Topic archived. No new replies allowed.