|
Boost Users : |
Subject: Re: [Boost-users] program_options - example will not compile
From: Jason Roehm (jasonr_at_[hidden])
Date: 2013-03-12 15:40:37
> I want to compile this file which can be found in boost
> /libs/program_options/examples:
>
> A. g++ error. This is the command I am using with g++
> g++ first.cpp -o first -L/usr/local/lib/libboost_program_options.so
>
> and this is the error output:
>
> ------------
> /tmp/cctMoqyr.o: In function `main':
> first.cpp:(.text+0x1a): undefined reference to
> `boost::program_options::options_description::m_default_line_length'
<snip>
The -L argument to g++ specifies a *directory* to search for libraries.
The -l argument is used to specify which libraries you want to link. So,
a fixed version of the command line would be something like:
g++ first.cpp -o first -L/usr/local/lib -lboost_program_options
If /usr/local/lib is configured as one of the system library
directories, you might not even need the -L.
Jason
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net