473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ 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\Makefi le.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+0x 1bb):main.cpp: undefined reference to
`boost::program _options::optio ns_description: :options_descri ption(std::stri ng
const&)'
main.o(.text+0x 28c):main.cpp: undefined reference to
`boost::program _options::optio ns_description: :add_options()'
main.o(.text+0x 2b0):main.cpp: undefined reference to
`boost::program _options::optio ns_description_ easy_init::oper ator()(char
const*, char const*)'
main.o(.text+0x 2d2):main.cpp: undefined reference to
`boost::program _options::optio ns_description_ easy_init::oper ator()(char
const*, boost::program_ options::value_ semantic const*, char const*)'
main.o(.text+0x 2e0):main.cpp: undefined reference to
`boost::program _options::varia bles_map::varia bles_map()'

main.o(.text+0x 370):main.cpp: undefined reference to
`boost::program _options::store (boost::program _options::basic _parsed_options <char>
const&, boost::program_ options::variab les_map&, bool)'
main.o(.text+0x 449):main.cpp: undefined reference to
`boost::program _options::notif y(boost::progra m_options::vari ables_map&)'
main.o(.text+0x 589):main.cpp: undefined reference to
`boost::program _options::opera tor<<(std::ostr eam&,
boost::program_ options::option s_description const&)'
main.o(.text$_Z NK5boost15progr am_options13var iables_mapixERK Ss[boost::program_ options::variab les_map::operat or[](std::basic_str ing<char,
std::char_trait s<char>, std::allocator< char> > const&)
const]+0x14):main.cpp : undefined reference to
`boost::program _options::abstr act_variables_m ap::operator[](std::string
const&) const'
main.o(.text$_Z N5boost15progra m_options13vari ables_mapD1Ev[boost::program_ options::variab les_map::~varia bles_map()]+0x3a):main.cpp :
undefined reference to `vtable for boost::program_ options::variab les_map'
main.o(.text$_Z N5boost15progra m_options25basi c_command_line_ parserIcEC1EiPP c[boost::program_ options::basic_ command_line_pa rser<char>::bas ic_command_line _parser(int,
char**)]+0x9b):main.cpp : undefined reference to
`boost::program _options::commo n_command_line_ parser::common_ command_line_pa rser(std::vecto r<std::string,
std::allocator< std::string> > const&)'
main.o(.text$_Z NK5boost15progr am_options25bas ic_command_line _parserIcE3runE v[boost::program_ options::basic_ command_line_pa rser<char>::run ()
const]+0x15):main.cpp : undefined reference to
`boost::program _options::commo n_command_line_ parser::run() const'
main.o(.text$_Z N5boost15progra m_options29valu e_semantic_code cvt_helperIcED2 Ev[boost::program_ options::value_ semantic_codecv t_helper<char>: :~value_semanti c_codecvt_helpe r()]+0xb):main.cpp:
undefined reference to `vtable for
boost::program_ options::value_ semantic_codecv t_helper<char>'
main.o(.text$_Z N5boost15progra m_options29valu e_semantic_code cvt_helperIcEC2 Ev[boost::program_ options::value_ semantic_codecv t_helper<char>: :value_semantic _codecvt_helper ()]+0x16):main.cpp :
undefined reference to `vtable for
boost::program_ options::value_ semantic_codecv t_helper<char>'
main.o(.text$_Z N5boost15progra m_options11to_i nternalISsEESt6 vectorISsSaISsE ERKS2_IT_SaIS5_ EE[std::vector<std ::basic_string< char,
std::char_trait s<char>, std::allocator< char> >,
std::allocator< std::basic_stri ng<char, std::char_trait s<char>,
std::allocator< char> > > >
boost::program_ options::to_int ernal<std::basi c_string<char,
std::char_trait s<char>, std::allocator< char> >
(std::vector<s td::basic_strin g<char, std::char_trait s<char>,

std::allocator< char> >, std::allocator< std::basic_stri ng<char,
std::char_trait s<char>, std::allocator< char> > > > const&)]+0xd4):main.cpp :
undefined reference to `boost::program _options::to_in ternal(std::str ing
const&)'
main.o(.rdata$_ ZTVN5boost15pro gram_options11t yped_valueIicEE[vtable for
boost::program_ options::typed_ value<int, char>]+0x1c):main.cpp : undefined
reference to
`boost::program _options::value _semantic_codec vt_helper<char> ::parse(boost:: any&,
std::vector<std ::string, std::allocator< std::string> > const&, bool) const'
main.o(.text$_Z NK5boost15progr am_options11typ ed_valueIicE4na meEv[boost::program_ options::typed_ value<int,
char>::name() const]+0x80):main.cpp : undefined reference to
`boost::program _options::arg'
main.o(.text$_Z NK5boost15progr am_options11typ ed_valueIicE4na meEv[boost::program_ options::typed_ value<int,
char>::name() const]+0x162):main.cp p: undefined reference to
`boost::program _options::arg'
main.o(.text$_Z N5boost15progra m_options8valid ateIicEEvRNS_3a nyERKSt6vectorI SbIT0_St11char_ traitsIS5_ESaIS 5_EESaIS9_EEPT_ l[void
boost::program_ options::valida te<int, char>(boost::an y&,
std::vector<std ::basic_string< char, std::char_trait s<char>,
std::allocator< char> >, std::allocator< std::basic_stri ng<char,
std::char_trait s<char>, std::allocator< char> > > > const&, int*,
long)]+0x4c):main.cpp : undefined reference to
`boost::program _options::valid ators::check_fi rst_occurrence( boost::any
const&)'
main.o(.text$_Z N5boost15progra m_options8valid ateIicEEvRNS_3a nyERKSt6vectorI SbIT0_St11char_ traitsIS5_ESaIS 5_EESaIS9_EEPT_ l[void
boost::program_ options::valida te<int, char>(boost::an y&,
std::vector<std ::basic_string< char, std::char_trait s<char>,
std::allocator< char> >, std::allocator< std::basic_stri ng<char,
std::char_trait s<char>, std::allocator< char> > > > const&, int*,
long)]+0x1e1):main.cp p: undefined reference to
`boost::program _options::inval id_option_value ::invalid_optio n_value(std::st ring
const&)'
main.o(.text$_Z N5boost15progra m_options16vali dation_errorD2E v[boost::program_ options::valida tion_error::~va lidation_error( )]+0x3a):main.cpp :
undefined reference to `vtable for boost::program_ options::valida tion_error'
main.o(.text$_Z N5boost15progra m_options16vali dation_errorD1E v[boost::program_ options::valida tion_error::~va lidation_error( )]+0x3a):main.cpp :
undefined reference to `vtable for boost::program_ options::valida tion_error'
main.o(.text$_Z N5boost15progra m_options16vali dation_errorC1E RKSs[boost::program_ options::valida tion_error::val idation_error(s td::basic_strin g<char,
std::char_trait s<char>, std::allocator< char> > const&)]+0x53):main.cpp :
undefined reference to `vtable for boost::program_ options::valida tion_error'
main.o(.rdata$_ ZTVN5boost15pro gram_options20i nvalid_option_v alueE[vtable for
boost::program_ options::invali d_option_value]+0x10):main.cpp : undefined
reference to `boost::program _options::valid ation_error::wh at() 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_des cription desc("Allowed options");
desc.add_option s()
("help", "produce help message")
("compressio n", po::value<int>( ), "set compression level")
;

po::variables_m ap vm;
po::store(po::p arse_command_li ne(ac, av, desc), vm);
po::notify(vm);

if (vm.count("help ")) {
cout << desc << "\n";
return 1;
}

if (vm.count("comp ression")) {
cout << "Compressio n level was set to "
<< vm["compressio n"].as<int>() << ".\n";
} else {
cout << "Compressio n 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 7790
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
2094
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 suprised, because always think that boost doesn't require any library, it uses templates, doesn't it? Maybe it is program_options error? Please help.
16
2614
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 years now. The first two postings in this group this morning are addressed almost trivially by using libraries from www.boost.org. IMO, the functionality in boost increases the usability of C++ at least as much as the standard library does. ...
2
2456
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() ("help", "produce help message") ("input,I", program_options::value<string>(&InputName), "Input md5mesh File") ("out-skl,S", program_options::value<string>(&OutputSkeletonName),
1
2140
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: /////////////////////////////////////////////////////////////////// // General options selector template <class T> void CmdLine::GetOption(const std::string& Name, T& var) { if (VariablesMap_.count(Name)) var = VariablesMap_.as<T>();
5
1993
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 compiled :( I'm use: boost 1.32 STLPort 4.6.2 Visual C++ 7.1 WinXP SP2 Prof
1
5383
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; int main(int ac, char* av)
0
2345
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"); desc.add_options() ("help,h", "Print help message.")
0
1393
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() ("nodes,n", po::value<vector<string (&opt)->default_value("*"), "Name of node(s) to print.") ;
1
3398
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 = boost::program_options; struct CommandLineParser { CommandLineParser()
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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 we have to send another system
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.