473,493 Members | 4,347 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

boost program_options link error

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::options_description::opti ons_description(std::string
const&)'
main.o(.text+0x28c):main.cpp: undefined reference to
`boost::program_options::options_description::add_ options()'
main.o(.text+0x2b0):main.cpp: undefined reference to
`boost::program_options::options_description_easy_ init::operator()(char
const*, char const*)'
main.o(.text+0x2d2):main.cpp: undefined reference to
`boost::program_options::options_description_easy_ init::operator()(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_opti ons::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_opt ions::variables_map&)'
main.o(.text+0x589):main.cpp: undefined reference to
`boost::program_options::operator<<(std::ostream&,
boost::program_options::options_description const&)'
main.o(.text$_ZNK5boost15program_options13variable s_mapixERKSs[boost::program_options::variables_map::operator[](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::o 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_com mand_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_parse r::common_command_line_parser(std::vector<std::str ing,
std::allocator<std::string> > const&)'
main.o(.text$_ZNK5boost15program_options25basic_co mmand_line_parserIcE3runEv[boost::program_options::basic_command_line_parser< char>::run()
const]+0x15):main.cpp: undefined reference to
`boost::program_options::common_command_line_parse r::run() const'
main.o(.text$_ZN5boost15program_options29value_sem antic_codecvt_helperIcED2Ev[boost::program_options::value_semantic_codecvt_hel per<char>::~value_semantic_codecvt_helper()]+0xb):main.cpp:
undefined reference to `vtable for
boost::program_options::value_semantic_codecvt_hel per<char>'
main.o(.text$_ZN5boost15program_options29value_sem antic_codecvt_helperIcEC2Ev[boost::program_options::value_semantic_codecvt_hel per<char>::value_semantic_codecvt_helper()]+0x16):main.cpp:
undefined reference to `vtable for
boost::program_options::value_semantic_codecvt_hel per<char>'
main.o(.text$_ZN5boost15program_options11to_intern alISsEESt6vectorISsSaISsEERKS2_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_str ing<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&)]+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_he lper<char>::parse(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&, bool) const'
main.o(.text$_ZNK5boost15program_options11typed_va lueIicE4nameEv[boost::program_options::typed_value<int,
char>::name() const]+0x80):main.cpp: undefined reference to
`boost::program_options::arg'
main.o(.text$_ZNK5boost15program_options11typed_va lueIicE4nameEv[boost::program_options::typed_value<int,
char>::name() const]+0x162):main.cpp: undefined reference to
`boost::program_options::arg'
main.o(.text$_ZN5boost15program_options8validateIi cEEvRNS_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_o ccurrence(boost::any
const&)'
main.o(.text$_ZN5boost15program_options8validateIi cEEvRNS_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::inv alid_option_value(std::string
const&)'
main.o(.text$_ZN5boost15program_options16validatio n_errorD2Ev[boost::program_options::validation_error::~validat ion_error()]+0x3a):main.cpp:
undefined reference to `vtable for boost::program_options::validation_error'
main.o(.text$_ZN5boost15program_options16validatio n_errorD1Ev[boost::program_options::validation_error::~validat ion_error()]+0x3a):main.cpp:
undefined reference to `vtable for boost::program_options::validation_error'
main.o(.text$_ZN5boost15program_options16validatio n_errorC1ERKSs[boost::program_options::validation_error::validati on_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_options20invali d_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::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;
}
Jul 23 '05 #1
1 7769
Hardy wrote:
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.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2076
by: SnaiL | last post by:
I've try to compile simple program which uses boost::program_options and got error like this: LINK : fatal error LNK1104: cannot open file 'libboost_program_options-vc7-mt-s-1_32.lib' I was...
16
2570
by: Jeff Flinn | last post by:
At the risk of raising the OT ire of some here, I'd like to know what might be done to raise the awareness of the boost libraries. I've found boost and it's libraries invaluable in my work for ~5...
2
2421
by: Starfox | last post by:
The Following Code: //Setup the options string InputName, OutputSkeletonName, OutputModelName; program_options::options_description OptionDesc("Available Options"); OptionDesc.add_options()...
1
2116
by: Krivenok Dmitry | last post by:
I use boost program_options library in my project. But I have one trouble and can't solve it :( I writing simple wrapper class and use generic selector:...
5
1963
by: p_kolya | last post by:
Hello! I'am build boost 1.32, but some libraries (program_options for example) didn't compile because of errors. For example file: boost\program_options\detail\utf8_codecvt_facet.hpp can't be...
1
5344
by: cesco | last post by:
Hi, I'm using the boost library program_options for parsing the command line given to my program as described in the class Parameter: // Main.cpp #include "Parameter.h" using namespace std;...
0
2317
by: pallav | last post by:
hi i'm using the boost::program_options and i'm having some problems with syntax: the code in question is the following: vector<string> opt; po::options_description desc("Usage"); ...
0
1361
by: pallav | last post by:
i'm using the boost:rogram_options and i'm having some problems with syntax: the code in question is the following: vector<stringopt; po:ptions_description desc("Usage"); desc.add_options()...
1
3368
by: zade | last post by:
Hi all boost::program_options needs be builled into libraries, static or dynamic. I use MSVC7.1 to build the boost::program_options for my project .In my .cpp file , I write: namespace po =...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.