C ++ auto does not name type

I use the auto keyword in my code

137 auto i = boost::find(adresses, adress); 

When compiling with the following command, I get these errors

 [ vickey@tb tests]$ clear;g++ testCoverDownloader.cpp ../CoverDownloader.cpp -I /usr/include/QtGui/ -I /usr/include/QtCore/ -lQtGui -lQtCore -std=c++0x ../CoverDownloader.cpp:137:10: error: 'i' does not name a type ../CoverDownloader.cpp:139:8: error: 'i' was not declared in this scope 

using -std = c ++ 0x should have done the trick. What's wrong?

+6
source share
1 answer

boost headers do not work for the same reason as Qt headers, unless you specify -I /usr/include/QtCore/ . There is nothing special in boost headers for the compiler to be partial with respect to them. The search section in the GCC documentation can help you.

+3
source

Source: https://habr.com/ru/post/918315/


All Articles