Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ auto does not name a type

Tags:

c++

c++11

auto

I m using keyword auto in my code

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

On compiling with 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 is wrong ?

like image 621
Vihaan Verma Avatar asked Jun 18 '12 03:06

Vihaan Verma


1 Answers

The boost headers aren't getting picked up for the same reason the Qt headers wouldn't unless you specify -I /usr/include/QtCore/. There is nothing special about the boost headers for the compiler to be partial towards them. The Search Path section of GCC's documentation may help you.

like image 101
dirkgently Avatar answered Oct 24 '22 18:10

dirkgently