[program_options] simple test case fails
Hi there, I'm working against the trunk but the following program
doesn't run properly.
#include <iostream>
#include
AMDG Christian Henning wrote:
Hi there, I'm working against the trunk but the following program doesn't run properly.
#include <iostream> #include
using namespace std;
namespace po = boost::program_options;
int main(int argc, char* argv[]) { string input;
po::options_description desc("Allowed options"); desc.add_options() ( "help,h" , "produce help message" ) ( "input,i" , po::value<string>( &input ), "Input File" );
po::variables_map vm; po::store( po::parse_command_line(argc, argv, desc), vm ); po::notify( vm );
if( vm.count( "help" )) { cout << desc << endl; return 1; } }
When calling po::store() I get an assertion saying: "Expression: map/set iterators incompatible". My command line parameter is "--help".
I'm using autolink and MSVC 2005.
It works fine for me. Do you have any special project settings? In Christ, Steven Watanabe
Hi again. Sorry Steven for not replying to your last email. This time,
I have tried something different and it worked! I basically rebuild
program_options with _SECURE_SCL and _HAS_ITERATOR_DEBUGGING enabled.
Can you double check whether or not you have these two symbols
enabled?
My program options are a simple "--input=ddd".
I have tried the test program ( see below ) on a different machine and
it blows up too.
Regards,
Christian
#include <iostream>
#include
Christian Henning wrote:
Hi again. Sorry Steven for not replying to your last email. This time,
Christian, please excuse me for a bit of nit-picking, but: 1. Please quote the email you reply to, leaving enough context to understand new message. 2. Please configure your email client to use the reply-to functionality properly. As it stands, your email is displayed on the top-level of my NNTP reader, not as part of any thread and there's no context whatsoever, so even if I could suggest something, I am unable to understand anything.
I have tried something different and it worked! I basically rebuild program_options with _SECURE_SCL and _HAS_ITERATOR_DEBUGGING enabled. Can you double check whether or not you have these two symbols enabled?
My program options are a simple "--input=ddd".
I have tried the test program ( see below ) on a different machine and it blows up too.
Stracktrace of the blow up is usually required for any diagnostics. Thanks, Volodya
Vladimir Prus wrote:
Christian Henning wrote:
Hi again. Sorry Steven for not replying to your last email. This time,
Christian,
please excuse me for a bit of nit-picking, but:
1. Please quote the email you reply to, leaving enough context to understand new message. 2. Please configure your email client to use the reply-to functionality properly.
I was told, offlist, that the In-Reply-To header is in fact correct. The issue appears to be that original email is from July, so it is already expired from my NNTP reader. So, point (2) is nonsense; sorry about that and ignore it. Point (1) however still stands. And, in fact, the values of _SECURE_SCL and _HAS_ITERATOR_DEBUGGING should be the same when building your project and when building Boost libraries. Mismatch is likely to cause various mishaps. - Volodya
Hi Vladimir, I don't mind nitpicking. In fact, I agree with you. My last email was targeted at Steven. I apologize for the confusion. Now back to business. ;-)
And, in fact, the values of _SECURE_SCL and _HAS_ITERATOR_DEBUGGING should be the same when building your project and when building Boost libraries. Mismatch is likely to cause various mishaps.
Even in debug builds? As a matter of fact, when I enable the two preprocessor symbols in my debug build the crash disappears. Mhmm, that's strange in my eyes. Seems to me when building boost with compile.cmd the symbols should be enabled while for release they should be disabled. I guess you can never be careful enough. Thanks Vladimir, you helped me a great deal. I had some weird things happening in the past with program_options. Now, I hope I'm over that. Christian
participants (3)
-
Christian Henning
-
Steven Watanabe
-
Vladimir Prus