
I change the demo code of program_option first.cpp as below, when I compiled with cl /MDd /EHsc /D "BOOST_ANY_DYN_LINK" /D "_STLP_DEBUG" first.cpp when run "first --help", a runtime error will occur. when cl /MD /EHsc /D "BOOST_ANY_DYN_LINK" first.cpp, there is no runtime error running "first --help". ---------------------------------------------------------------------------- ------------------- #include <boost/program_options.hpp> namespace po = boost::program_options; #include <iostream> #include <iterator> using namespace std; int main(int ac, char* av[]) { try { po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message, a very very very very very long long long long long long information") // The reason of rumtime error ("compression", po::value<int>(), "set compression level") ; po::variables_map vm; po::store(po::parse_command_line(ac, av, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 1; } if (vm.count("compression")) { cout << "Compression level was set to " << vm["compression"].as<int>() << ".\n"; } else { cout << "Compression level was not set.\n"; } } catch(exception& e) { cerr << "error: " << e.what() << "\n"; return 1; } catch(...) { cerr << "Exception of unknown type!\n"; } return 0; } ---------------------------------------------------------------------------- ------------------------ I also trace the error and find it occurs in the code call format_one()/format_description/format_paragraph The error code is line 361, options_description.cpp: if (line_begin + (line_length - indent) > par_end) { line_end = par_end; } else { line_end = line_begin + (line_length - indent); } ----- Original Message ----- From: "Vladimir Prus" <ghost@cs.msu.su> To: <boost-users@lists.boost.org> Sent: Tuesday, September 06, 2005 1:51 PM Subject: Re: [Boost-users] A error when using long option description,program_options library
??? wrote:
This runtime error only occurs when debug version, the release version has no such problem. The long option description can not be printed.
My platform is vc7.1+stlport 4.62+boost 1.33, I also define the macro _STLP_DEBUG and BOOST_LIB_DIAGNOSTIC.
Some extraction of my code: operatoins.add_options() ("difference,d", "Get all the word of mine, origin file, my file, output file")
.......
when print "Get all the word of mine, origin file, my file, output ", a runtime error occurs, the program terminates.
Please provide the minimal complete program that reproduces this, and I'll try to debug this.
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users