|
Boost Users : |
Subject: Re: [Boost-users] string iterator not dereferencable
From: gale82 (gale82_at_[hidden])
Date: 2009-02-07 16:48:59
Thank you for replying.
As I explained, I deleted my main method and I inserted first.cpp
(boost program_option example) in my project. It compiles f but when I
pass an options to the command line (ex. --help) the assertion fails.
Note that the program has no problem if no parameter is passed to the
command line.
Back trace from the program shows that the line of boost code that
trigger the assertion is line 63 of options_description.cpp:
- if (*m_long_name.rbegin() == '*')
The trace is the following:
msvcp90d.dll!std::_Debug_message(const wchar_t * message=0x017f7918,
const wchar_t * file=0x017f7778, unsigned int line=112) Line 24 C++
SchedulerModel.exe!std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>
>::operator*() Line 112 + 0x14 bytes C++
SchedulerModel.exe!std::_Revranit<std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>
>,std::iterator<std::random_access_iterator_tag,char,int,char const
*,char const &> >::operator*() Line 1910 + 0xf bytes C++
> SchedulerModel.exe!boost::program_options::option_description::match(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & option="help", bool approx=true) Line 63 + 0x28 bytes C++
SchedulerModel.exe!boost::program_options::options_description::find_nothrow(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
name="help", bool approx=true) Line 269 + 0x26 bytes C++
SchedulerModel.exe!boost::program_options::detail::cmdline::finish_option(boost::program_options::basic_option<char>
& opt={...}, std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & other_tokens=[0]()) Line 294 + 0x28 bytes C++
SchedulerModel.exe!boost::program_options::detail::cmdline::run()
Line 238 C++
SchedulerModel.exe!boost::program_options::basic_command_line_parser<char>::run()
Line 102 + 0xf bytes C++
SchedulerModel.exe!boost::program_options::parse_command_line<char>(int
argc=2, char * * argv=0x00174e88, const
boost::program_options::options_description & desc={...}, int style=0,
boost::function1<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
const &> ext={...}) Line 119 + 0x8d bytes C++
SchedulerModel.exe!main(int ac=2, char * * av=0x00174e88) Line 27 +
0x39 bytes C++
SchedulerModel.exe!__tmainCRTStartup() Line 582 + 0x19 bytes C
SchedulerModel.exe!mainCRTStartup() Line 399 C
Since I am using cplex library, can it be that this problem is
triggered by a particular method/function in such a library ?
(date_time works perfectly)
Thank you again
Alessandro
On Fri, Feb 6, 2009 at 10:43 PM, Alex MDC <alex.mdc_at_[hidden]> wrote:
>>
>> I am newbie and I am developing in C++ using VC9, Boost 1.37, CPLEX
>> 11.1. I use date_time and program_options boost libraries and my program
>> compiles fine. Date_time works perfectly while program_options gives me a
>> runtime error saying "Debug assertion failed .... string iterator not
>> dereferencable" every time I pass any argument in the command line. The
>> assertion fails at line 112 of "C:\program files\microsoft visual studio
>> 9.0\vc\include\xstring"
>
> When you get the assertion failure, have a look at the back trace to find
> out which line in program_options and which line of your code it is coming
> from, maybe that will give more clues.
>
> If you're still stuck it is helpful if you can post a *small* but complete
> code snippet that can reproduce your problem, as there may be something very
> simple that you're doing wrong.
>
> Alex
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net