AW: g++ 4.4.0 auto keyword
Fehringer Franz
Franz.Fehringer@fja.com
Thu Jun 25 15:04:00 GMT 2009
-std=gnu++0x
-----Ursprüngliche Nachricht-----
Von: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] Im Auftrag von tsuraan
Gesendet: Donnerstag, 25. Juni 2009 17:02
An: gcc-help@gcc.gnu.org
Betreff: g++ 4.4.0 auto keyword
In the release notes for 4.4, it says that the auto keyword can be used for type inference, and the c++0x page provides some links to examples. It looks like this should be valid:
#include<iostream>
int main() {
auto t = 7;
std::cout << t << std::endl;
return 0;
}
However, when I try to compile this, I get:
g++-4.4.0 -o auto auto.cpp
auto.cpp: In function 'int main()':
auto.cpp:4: error: ISO C++ forbids declaration of 't' with no type
What am I doing wrong? Is there some switch I need to use to enable the c++0x functionality?
Please include my email address in any replies; I'm not on the gcc-help list. Thanks in advance.
More information about the Gcc-help
mailing list