Your compiler is too old to support range-based for
syntax. According to GNU , it was first supported in GCC 4.6. GCC also requires that you explicitly request C ++ 11 support by providing the -std=c++11
or c++0x
command-line -std=c++11
to compilers as old as yours.
If you cannot upgrade, you will need the old school equivalent:
for (auto it = inNwsFile.begin(); it != inNwsFile.end(); ++it) { std::string const &nwFile = *it;
I believe auto
is available in GCC 4.4 (if you enable C ++ 0x support) to save the std::vector<string>::const_iterator
entry.
If you really need a const
reference to vector elements, then whatever style of the loop you use, you need to remove the const
from the function parameter.
source share