c++ - AUTO variables error when I compile
- Alexandre (19/19) Apr 17 2014 I made this simple code sample, to show the erro:
- Hannes Steffenhagen (3/3) Apr 19 2014 Sounds like C++11 isn't enabled, auto is interpreted as a storage
I made this simple code sample, to show the erro: #include <iostream> using namespace std; int main(int argc, char **argv) { auto foo = "Ola mundo"; auto bar = 15; cout << foo << " -> " << bar << endl; return 0; } and, when I try to build, I got that error: $dmc main.cpp -I\dm\stlport\stlport auto foo = "Ola mundo"; ^ main.cpp(7) : Error: need explicit cast to convert from: char const * to : int --- errorlevel 1 Btw, how to use the auto variables ?
Apr 17 2014
Sounds like C++11 isn't enabled, auto is interpreted as a storage qualifier and the type is defaulted to int. There's probably some switch for dmc to enable C++11, I don't use it myself though.
Apr 19 2014