Problem with boost::program_options
Hi, I'm having a problem with boost::program_options. I attached a stripped-down version of the code that demonstrates the problem. I have a number of positional arguments ( "ops" ), and one normal argument ( "input-file,i" ). Now, if i run the program ./op_test pos0 pos1 pos2 -i non_positional it interpretes the "non_positional" as further positional arg, and not as parameter belonging to -i. Any hints on how to solve this are greatly appreciated. I ran it on: Mac OS X 10.4 on a G5, with the latest XCode ( gcc 4.0.1 ) boost 1.34 Jonas
Hi,
I think the standard command-line format is
./program [args] [positional_args...]
Therefore it expects:
./op_test -i non_positional pos0 pos1 pos2
Chris
On 6/8/07, Jonas Bösch
Hi,
I'm having a problem with boost::program_options. I attached a stripped-down version of the code that demonstrates the problem. I have a number of positional arguments ( "ops" ), and one normal argument ( "input-file,i" ).
Now, if i run the program
./op_test pos0 pos1 pos2 -i non_positional
it interpretes the "non_positional" as further positional arg, and not as parameter belonging to -i.
Any hints on how to solve this are greatly appreciated.
I ran it on: Mac OS X 10.4 on a G5, with the latest XCode ( gcc 4.0.1 ) boost 1.34
Jonas
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, On Jun 10, 2007, at 18:04 , Chris Weed wrote:
Hi, I think the standard command-line format is ./program [args] [positional_args...]
Therefore it expects: ./op_test -i non_positional pos0 pos1 pos2
Yes, but this doesn't work either; It still thinks non_positional is one of the positional args... If you run the attached program ( from my last mail ), it will print out all options recognized as positionals... Greets, Jonas
It looks like the problem is that you didn't specify a boost_po::value for -i.
_generic_options.add_options()
("input-file,i",boost_po::valuestd::string(), "specify input file")
("ops", boost_po::value< std::vector< std::string > >(),
"specify operators " )
;
Chris
On 6/10/07, Jonas Boesch
Hi,
On Jun 10, 2007, at 18:04 , Chris Weed wrote:
Hi, I think the standard command-line format is ./program [args] [positional_args...]
Therefore it expects: ./op_test -i non_positional pos0 pos1 pos2
Yes, but this doesn't work either; It still thinks non_positional is one of the positional args...
If you run the attached program ( from my last mail ), it will print out all options recognized as positionals...
Greets,
Jonas _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Chris Weed
-
Jonas Boesch
-
Jonas Bösch