Boost logo

Boost Users :

Subject: [Boost-users] [program options] option_groups.cpp example doesn't compile
From: U.Mutlu (for-gmane_at_[hidden])
Date: 2015-02-15 13:03:49

I've boost 1.55 from the debian repository.
I'm trying to compile the below example of the 1.55 version
(it's same as that of 1.57), but I get the following compile errors.
Should I use some 'magic' compiler options, or what else is the reason for
this grandious failure?

$ g++ -Wall -std=gnu++11 option_groups.cpp -lboost_program_options
option_groups.cpp: In function ‘int main(int, char**)’:
option_groups.cpp:44:46: error: ‘class
boost::program_options::typed_value<std::basic_string<char>, char>’ has no
member named ‘implicit’
              ("help-module", value<string>()->implicit(),
option_groups.cpp:96:11: error: reference to ‘exception’ is ambiguous
      catch(exception& e) {
In file included from /usr/include/c++/4.9/new:40:0,
                  from /usr/include/c++/4.9/ext/new_allocator.h:33,
                  from /usr/include/c++/4.9/bits/allocator.h:46,
                  from /usr/include/c++/4.9/string:41,
                  from /usr/include/boost/program_options/errors.hpp:12,
                  from option_groups.cpp:24:
/usr/include/c++/4.9/exception:60:9: note: candidates are: class std::exception
    class exception
In file included from /usr/include/boost/throw_exception.hpp:43:0,
                  from /usr/include/boost/any.hpp:26,
                  from /usr/include/boost/program_options/value_semantic.hpp:12,
                  from option_groups.cpp:24:
/usr/include/boost/exception/exception.hpp:208:5: note: class
option_groups.cpp:96:11: error: ‘exception’ does not name a type
      catch(exception& e) {
option_groups.cpp:97:17: error: ‘e’ was not declared in this scope
          cout << e.what() << "\n";

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at