3

Running into an issue with Boost Program Options. I added a multiple use option let's call it "--opt". When I run the program.exe from the command line with two "--opt" I get the following error from boost.

terminating with uncaught exception of type boost::exception_detail::clone_impl >: boost::bad_any_cast: failed conversion using boost::any_cast

I am unsure what exactly is causing boost::bad_any_cast. I am a novice when it comes to C++ and Boost. Below is an example of the code I am using and where I think the boost::bad_any_cast might be occurring. The error only appeared after I added the std::vector. Any thoughts what could be the issue? Or any resources to point me so I could figure it out on my own too?

po::value<std::vector<std::string>>()

I am well aware of this previous question as well.

Community
  • 1
  • 1
MikeG
  • 63
  • 1
  • 7

1 Answers1

0

try to add ->required() after the cast : po::value>()->required()

Midou
  • 3
  • 5