-2

I'm trying to compile my old Qt project on another system: Windows XP, Qt5, msvc 2010.

I used c++11 auto in my project, there is a line CONFIG += c++11 in the pro file.

for(auto e : mapTerm->keys())
{
     mapTerm->insert(e, attrib.value(e).toString());
}

Now it cannot recognize the auto loop and gives me syntax errors.

Charlie
  • 197
  • 1
  • 13
  • MSVC 2010 is to old for c++11. – πάντα ῥεῖ Sep 06 '15 at 07:41
  • 1
    What is the auto loop? Some code would be nice... – RedX Sep 06 '15 at 07:49
  • You can use later Visual C++ versions (including Visual C++ 2015) with Windows XP by selecting the XP-compatible toolset in the project settings. Alternatively you can use the Visual C++ 2010 non-standard range based loop (the syntax is a little bit different as I recall), but I don't think there was any alternative to `auto`. So you'd have to spell out the type, or use the Visual ++ non-standard alternative to `decltype`. – Cheers and hth. - Alf Sep 06 '15 at 09:08

1 Answers1

0

You'll need to ensure that you are using the propper C++ compiler and that it is C++11+.

If you are using msvc and are using the correct version then this should be a built in feature.

WeeniehuahuaXD
  • 852
  • 3
  • 10
  • 30