Reputation: 805
Today I rebuilt my C++ application and the compilation failed. Nothing has changed though. The first error was in my class List
which inherits from std::vector
(private inheritance) here:
template<typename T> void List<T>::append(const T& value)
{
push_back(value);
}
I had to add std::vector<T>::
before push_back(value);
because no declarations were found by the compiler. I don’t really know why it happens, but there was an update of g++, I now use g++ v4.7.0 (prerelease) using C++11 on Arch Linux.
I fixed that issue, but now, the real problem, is that I can’t compile the rest of the application because of a problem in the Boost library program_options
. I include the library with:
#include <boost/config.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
The errors:
g++ -m64 -pipe -pedantic -Wextra -std=gnu++0x -c -g -Wall -DDEBUG -DDEV -DMYSQL_SUPPORT -I. -IHeaders -MMD -MP -MF build/Debug/GNU-Linux-x86/Sources/Libs/Settings.o.d -o build/Debug/GNU-Linux-x86/Sources/Libs/Settings.o Sources/Libs/Settings.cpp
/usr/include/boost/program_options/detail/config_file.hpp: In instantiation of ‘bool boost::program_options::detail::basic_config_file_iterator<charT>::getline(std::string&) [with charT = char; std::string = std::basic_string<char>]’:
In file included from Sources/Libs/Settings.cpp:33:0:
Sources/Libs/Settings.cpp:69:24: required from here
/usr/include/boost/program_options/detail/config_file.hpp:163:13: erreur: ‘to_internal’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
In file included from /usr/include/boost/program_options/detail/parsers.hpp:9:0,
from /usr/include/boost/program_options/parsers.hpp:265,
from Sources/Libs/Settings.cpp:34:
/usr/include/boost/program_options/detail/convert.hpp:75:34: note: ‘template<class T> std::vector<std::basic_string<char> > boost::program_options::to_internal(const std::vector<T>&)’ declared here, later in the translation unit
The same errors than with my List class…
Thank you!
Upvotes: 3
Views: 1354
Reputation: 5510
I suspect you have been bitten by changes in the two phase lookup rule for template instantiations in gcc 4.7.
I can't give any more practical advice without source code, but gcc4.7 changes (chapter C++) gives a description of two phase lookup and suggests some code corrections.
Upvotes: 3