Refer to this image on how to enable C++11 mode on CodeBlocks.
why can't I use "auto" in codeblocks in linux
-
11-06-2023 - |
Domanda
it's my first time to use auto
in c++, and I work on linux, but I find it doesn't work at all. I want to know what happened. It's my code:
//<STL container.cpp>
//date: 2014.3.9 10:45
#include<iostream>
//#include<iterator>
#include<vector>
using namespace std;
int main()
{
double a= 10.0;
auto b=a;
cout<<b;
//for(auto it = mydata.begin();;it!=mydata.end();it++)
// cout<<" "<<*it;
cout<<endl;
return 0;
}
and codeblocks told me :
error:'b' does not name a type
error:'b' was not declared in this scope
I want to know whether codeblocks doesn't refer to auto
or linux doesn't.
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow