Compile error in Boost librairies (program_options)
I rebuilt my C ++ application today and the compilation failed. However, nothing has changed. The first error was in my class List
that 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 know why this is happening, but there was a g ++ update, now I am using g ++ v4.7.0 (preerelease) using C ++ 11 on Arch Linux.
I fixed this issue, but now the real problem is that I cannot compile the rest of the application due to an issue in the Boost library program_options
. I am including the library with:
#include <boost/config.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
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
Same errors as in my List class ...
Thank!
source to share
I suspect you have been bitten by changes to the two phase search rule for template instances in gcc 4.7.
I can't give any practical advice without source code, but gcc4.7 changes (C ++ chapter) gives a description of the two phases of the search and suggests some code adjustments.
source to share