Boost logo

Boost :

From: Jens Müller (jens.mueller_at_[hidden])
Date: 2006-12-09 05:46:09


I have the following program:

#include <string>
#include <iostream>
#include <boost/program_options.hpp>

namespace po = boost::program_options;

int main(char argc,char** argv)
{
   using std::string;

   // Kommandozeile parsen
   po::options_description desc("Allowed options");
   desc.add_options()
     ("help,H", "print help message")
   ;

   po::variables_map vm;
   po::store(po::parse_command_line(argc, argv, desc), vm) ;
   po::notify(vm);

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

Results when building with 1.33.1 headers and linking against 1.33.1 libs:

$ cc -c -o separator2.o -g -Wall -Wno-deprecated -pipe -O -I.
-I/home/jmueller/software/boost/include separator2.cpp
$ cc -lboost_program_options-gcc-d -L/home/jmueller/software/boost/lib
-o separator2 separator2.o
$ ./separator2
$ ./separator2 --help
Allowed options:
   -H [ --help ] print help message

Results when building with CVS headers and linking against CVS libs:

$ cc -c -o separator2.o -g -Wall -Wno-deprecated -pipe -O -I.
-I/home/jmueller/software/boost-cvs/include separator2.cpp
$ cc -lboost_program_options-gcc-d
-L/home/jmueller/software/boost-cvs/lib -o separator2 separator2.o
$ ./separator2 --help
Segmentation fault

My compiler:
$ cc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp
--disable-libssp --enable-java-awt=gtk --enable-gtk-cairo
--disable-libjava-multilib --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new
--without-system-libunwind --with-cpu=generic --host=i586-suse-linux
Thread model: posix
gcc version 4.1.0 (SUSE Linux)

Has anyone an idea what's going wrong here? If you need further info,
please ask.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk