boost program_options link error

H

Hardy

Hi, just come into the boost world. just the first.cpp in the
program_options examples, with many link error...
devc++4.9.9.2, gcc 3.4.2,
can I get your opinions on this problem? thank you~


make.exe -f "D:\temp\Makefile.win" all
g++.exe -c main.cpp

-o
ain.o -I"F:/Source/Boost/boost_1_32_0" -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
-I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"
-I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

g++.exe main.o -o "PO.exe" -L"C:/Dev-Cpp/lib"

main.o(.text+0x1bb):main.cpp: undefined reference to
`boost::program_options::eek:ptions_description::eek:ptions_description(std::string
const&)'
main.o(.text+0x28c):main.cpp: undefined reference to
`boost::program_options::eek:ptions_description::add_options()'
main.o(.text+0x2b0):main.cpp: undefined reference to
`boost::program_options::eek:ptions_description_easy_init::eek:perator()(char
const*, char const*)'
main.o(.text+0x2d2):main.cpp: undefined reference to
`boost::program_options::eek:ptions_description_easy_init::eek:perator()(char
const*, boost::program_options::value_semantic const*, char const*)'
main.o(.text+0x2e0):main.cpp: undefined reference to
`boost::program_options::variables_map::variables_map()'

main.o(.text+0x370):main.cpp: undefined reference to
`boost::program_options::store(boost::program_options::basic_parsed_options<char>
const&, boost::program_options::variables_map&, bool)'
main.o(.text+0x449):main.cpp: undefined reference to
`boost::program_options::notify(boost::program_options::variables_map&)'
main.o(.text+0x589):main.cpp: undefined reference to
`boost::program_options::eek:perator<<(std::eek:stream&,
boost::program_options::eek:ptions_description const&)'
main.o(.text$_ZNK5boost15program_options13variables_mapixERKSs[boost::program_options::variables_map::eek:perator[](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)
const]+0x14):main.cpp: undefined reference to
`boost::program_options::abstract_variables_map::eek:perator[](std::string
const&) const'
main.o(.text$_ZN5boost15program_options13variables_mapD1Ev[boost::program_options::variables_map::~variables_map()]+0x3a):main.cpp:
undefined reference to `vtable for boost::program_options::variables_map'
main.o(.text$_ZN5boost15program_options25basic_command_line_parserIcEC1EiPPc[boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int,
char**)]+0x9b):main.cpp: undefined reference to
`boost::program_options::common_command_line_parser::common_command_line_parser(std::vector<std::string,
std::allocator<std::string> > const&)'
main.o(.text$_ZNK5boost15program_options25basic_command_line_parserIcE3runEv[boost::program_options::basic_command_line_parser<char>::run()
const]+0x15):main.cpp: undefined reference to
`boost::program_options::common_command_line_parser::run() const'
main.o(.text$_ZN5boost15program_options29value_semantic_codecvt_helperIcED2Ev[boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper()]+0xb):main.cpp:
undefined reference to `vtable for
boost::program_options::value_semantic_codecvt_helper<char>'
main.o(.text$_ZN5boost15program_options29value_semantic_codecvt_helperIcEC2Ev[boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper()]+0x16):main.cpp:
undefined reference to `vtable for
boost::program_options::value_semantic_codecvt_helper<char>'
main.o(.text$_ZN5boost15program_options11to_internalISsEESt6vectorISsSaISsEERKS2_IT_SaIS5_EE[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::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&)]+0xd4):main.cpp:
undefined reference to `boost::program_options::to_internal(std::string
const&)'
main.o(.rdata$_ZTVN5boost15program_options11typed_valueIicEE[vtable for
boost::program_options::typed_value<int, char>]+0x1c):main.cpp: undefined
reference to
`boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&, bool) const'
main.o(.text$_ZNK5boost15program_options11typed_valueIicE4nameEv[boost::program_options::typed_value<int,
char>::name() const]+0x80):main.cpp: undefined reference to
`boost::program_options::arg'
main.o(.text$_ZNK5boost15program_options11typed_valueIicE4nameEv[boost::program_options::typed_value<int,
char>::name() const]+0x162):main.cpp: undefined reference to
`boost::program_options::arg'
main.o(.text$_ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorISbIT0_St11char_traitsIS5_ESaIS5_EESaIS9_EEPT_l[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)]+0x4c):main.cpp: undefined reference to
`boost::program_options::validators::check_first_occurrence(boost::any
const&)'
main.o(.text$_ZN5boost15program_options8validateIicEEvRNS_3anyERKSt6vectorISbIT0_St11char_traitsIS5_ESaIS5_EESaIS9_EEPT_l[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)]+0x1e1):main.cpp: undefined reference to
`boost::program_options::invalid_option_value::invalid_option_value(std::string
const&)'
main.o(.text$_ZN5boost15program_options16validation_errorD2Ev[boost::program_options::validation_error::~validation_error()]+0x3a):main.cpp:
undefined reference to `vtable for boost::program_options::validation_error'
main.o(.text$_ZN5boost15program_options16validation_errorD1Ev[boost::program_options::validation_error::~validation_error()]+0x3a):main.cpp:
undefined reference to `vtable for boost::program_options::validation_error'
main.o(.text$_ZN5boost15program_options16validation_errorC1ERKSs[boost::program_options::validation_error::validation_error(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)]+0x53):main.cpp:
undefined reference to `vtable for boost::program_options::validation_error'
main.o(.rdata$_ZTVN5boost15program_options20invalid_option_valueE[vtable for
boost::program_options::invalid_option_value]+0x10):main.cpp: undefined
reference to `boost::program_options::validation_error::what() const'
collect2: ld returned 1 exit status

make.exe: *** [PO.exe] Error 1



source file:

// Copyright Vladimir Prus 2002-2004.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)

/* The simplest usage of the library.
*/

#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::eek:ptions_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;
}
 
R

Rapscallion

Hardy said:
Hi, just come into the boost world. just the first.cpp in the
program_options examples, with many link error...
devc++4.9.9.2, gcc 3.4.2,
can I get your opinions on this problem? thank you~

Off topic. Try the Boost mailing lists.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,955
Messages
2,570,117
Members
46,705
Latest member
v_darius

Latest Threads

Top