Subject: [Boost-bugs] [Boost C++ Libraries] #4908: Bug in program_options
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-29 22:03:34
#4908: Bug in program_options
------------------------------+---------------------------------------------
Reporter: dix75@⦠| Owner: vladimir_prus
Type: Bugs | Status: new
Milestone: To Be Determined | Component: program_options
Version: Boost 1.45.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
In a simple example, I get errors
OS Linux x64 (Kubuntu 10.10)
g++ 4.5
Example (boost/libs/program_options/example/first.cpp)
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <iostream>
#include <iterator>
using namespace std;
int main(int ac, char* av[])
{
try {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("compression", po::value<int>(), "set compression level")
;
po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);
if (vm.count("help")) {
cout << desc << "\n";
return 1;
}
if (vm.count("compression")) {
cout << "Compression level was set to "
<< vm["compression"].as<int>() << ".\n";
} else {
cout << "Compression level was not set.\n";
}
}
catch(exception& e) {
cerr << "error: " << e.what() << "\n";
return 1;
}
catch(...) {
cerr << "Exception of unknown type!\n";
}
return 0;
}
I have[[BR]]
/home/dix/Projects/Test/CppApplication_1/main.cpp:13: undefined reference
to `boost::program_options::options_description::m_default_line_length'
/home/dix/Projects/Test/CppApplication_1/main.cpp:13: undefined reference
to `boost::program_options::options_description::m_default_line_length'
/home/dix/Projects/Test/CppApplication_1/main.cpp:13: undefined reference
to
`boost::program_options::options_description::options_description(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, unsigned int,
unsigned int)'
/home/dix/Projects/Test/CppApplication_1/main.cpp:15: undefined reference
to `boost::program_options::options_description::add_options()'
/home/dix/Projects/Test/CppApplication_1/main.cpp:15: undefined reference
to `boost::program_options::options_description_easy_init::operator()(char
const*, char const*)'
/home/dix/Projects/Test/CppApplication_1/main.cpp:17: undefined reference
to `boost::program_options::options_description_easy_init::operator()(char
const*, boost::program_options::value_semantic const*, char const*)'
/home/dix/Projects/Test/CppApplication_1/main.cpp:19: undefined reference
to `boost::program_options::variables_map::variables_map()'
/home/dix/Projects/Test/CppApplication_1/main.cpp:20: undefined reference
to
`boost::program_options::store(boost::program_options::basic_parsed_options<char>
const&, boost::program_options::variables_map&, bool)'
/home/dix/Projects/Test/CppApplication_1/main.cpp:21: undefined reference
to
`boost::program_options::notify(boost::program_options::variables_map&)'
/home/dix/Projects/Test/CppApplication_1/main.cpp:24: undefined reference
to `boost::program_options::operator<<(std::basic_ostream<char,
std::char_traits<char> >&, boost::program_options::options_description
const&)'
build/Debug/GNU-Linux-x86/main.o: In function `~validation_error':
/usr/local/include/boost/program_options/errors.hpp:153: undefined
reference to `vtable for boost::program_options::validation_error'
build/Debug/GNU-Linux-x86/main.o: In function
`value_semantic_codecvt_helper':
/usr/local/include/boost/program_options/value_semantic.hpp:91: undefined
reference to `vtable for
boost::program_options::value_semantic_codecvt_helper<char>'
build/Debug/GNU-Linux-x86/main.o: In function
`~value_semantic_codecvt_helper':
/usr/local/include/boost/program_options/value_semantic.hpp:91: undefined
reference to `vtable for
boost::program_options::value_semantic_codecvt_helper<char>'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::variables_map::operator[](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) const':
/usr/local/include/boost/program_options/variables_map.hpp:150: undefined
reference to
`boost::program_options::abstract_variables_map::operator[](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) const'
build/Debug/GNU-Linux-x86/main.o: In function `~variables_map':
/usr/local/include/boost/program_options/variables_map.hpp:143: undefined
reference to `vtable for boost::program_options::variables_map'
build/Debug/GNU-Linux-x86/main.o: In function `basic_command_line_parser':
/usr/local/include/boost/program_options/detail/parsers.hpp:43: undefined
reference to
`boost::program_options::detail::cmdline::cmdline(std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > const&)'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::basic_command_line_parser<char>::options(boost::program_options::options_description
const&)':
/usr/local/include/boost/program_options/detail/parsers.hpp:51: undefined
reference to
`boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description
const&)'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::basic_command_line_parser<char>::style(int)':
/usr/local/include/boost/program_options/detail/parsers.hpp:69: undefined
reference to `boost::program_options::detail::cmdline::style(int)'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&>)':
/usr/local/include/boost/program_options/detail/parsers.hpp:77: undefined
reference to
`boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&>)'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::basic_command_line_parser<char>::run()':
/usr/local/include/boost/program_options/detail/parsers.hpp:104: undefined
reference to `boost::program_options::detail::cmdline::run()'
build/Debug/GNU-Linux-x86/main.o: In function
`std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >
boost::program_options::to_internal<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
>(std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > const&)':
/usr/local/include/boost/program_options/detail/convert.hpp:79: undefined
reference to `boost::program_options::to_internal(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
build/Debug/GNU-
Linux-x86/main.o:(.rodata._ZTVN5boost15program_options11typed_valueIicEE[vtable
for boost::program_options::typed_value<int, char>]+0x38): undefined
reference to
`boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > const&, bool) const'
build/Debug/GNU-
Linux-x86/main.o:(.rodata._ZTVN5boost15program_options20invalid_option_valueE[vtable
for boost::program_options::invalid_option_value]+0x20): undefined
reference to `boost::program_options::validation_error::what() const'
build/Debug/GNU-
Linux-x86/main.o:(.rodata._ZTIN5boost15program_options11typed_valueIicEE[typeinfo
for boost::program_options::typed_value<int, char>]+0x18): undefined
reference to `typeinfo for
boost::program_options::value_semantic_codecvt_helper<char>'
build/Debug/GNU-Linux-x86/main.o: In function
`boost::program_options::typed_value<int, char>::name() const':
/usr/local/include/boost/program_options/detail/value_semantic.hpp:26:
undefined reference to `boost::program_options::arg'
/usr/local/include/boost/program_options/detail/value_semantic.hpp:28:
undefined reference to `boost::program_options::arg'
build/Debug/GNU-Linux-x86/main.o: In function `void
boost::program_options::validate<int, char>(boost::any&,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > const&, int*, long)':
/usr/local/include/boost/program_options/detail/value_semantic.hpp:85:
undefined reference to
`boost::program_options::validators::check_first_occurrence(boost::any
const&)'
/usr/local/include/boost/program_options/detail/value_semantic.hpp:91:
undefined reference to
`boost::program_options::invalid_option_value::invalid_option_value(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
build/Debug/GNU-Linux-x86/main.o: In function `std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&
boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > const&, bool)':
/usr/local/include/boost/program_options/detail/value_semantic.hpp:58:
undefined reference to
`boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
/usr/local/include/boost/program_options/detail/value_semantic.hpp:62:
undefined reference to
`boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
build/Debug/GNU-Linux-x86/main.o: In function `validation_error':
/usr/local/include/boost/program_options/errors.hpp:139: undefined
reference to `vtable for boost::program_options::validation_error'
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4908> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC