April 17, 2014 AUTO variables error when I compile | ||||
---|---|---|---|---|
| ||||
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 ? |
April 19, 2014 Re: AUTO variables error when I compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexandre | 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. |
Copyright © 1999-2021 by the D Language Foundation