Boost logo

Boost Users :

Subject: Re: [Boost-users] Program_options assertion failure Johnathan Bunn (2007-08-29 02:40:20)
From: Huml Pavel (nesp_at_[hidden])
Date: 2008-10-01 12:19:26


[boost_1_34_0 \ program_options]

 Johnathan Bunn wrote:

> im having an issue with a project using visual studio pro 2005
>
> if it makes a difference the librarys im using are
> Qt, pdflib, boost, and some crystal com stuff thorugh activex
>
> my problem is that when I build in release my command line args are parsed
> fine and my application behaves as expected.
>
> when I build in debug mode, I get an asertion failure as follows
>
> Assertion failed: n == name.size()-2, file
> libs\program_options\src\options_description.cpp, line 122

I had a same problem with MSVC 2005 when one of my other(no boost) libs use UNICODE.

There is probably some bug  in auto_link.hpp (when it generate library name and link it => some link mismach in boost STL raised).

My tricky solution is: Turn off  auto_link by statement before include program_option.hpp:

#define BOOST_PROGRAM_OPTIONS_NO_LIB ON
#include <boost/program_options.hpp>

 And link library which you need manually (probably libboost_program_options-vc80-mt-gd-1_34.lib) by option Link\Input\additional dependency.

There is a paradox: same library as is normaly included by auto_link can be used to include by MSVC option and then all see OK with no assertion.

Pavel

 

[boost_1_34_0 \ program_options] Johnathan Bunn wrote: > im having an issue with a project using visual studio pro 2005 > > if it makes a difference the librarys im using are > Qt, pdflib, boost, and some crystal com stuff thorugh activex > > my problem is that when I build in release my command line args are parsed > fine and my application behaves as expected. > > when I build in debug mode, I get an asertion failure as follows > > Assertion failed: n == name.size()-2, file > libs\program_options\src\options_description.cpp, line 122 I had a same problem with MSVC 2005 when one of my other(no boost) libs use UNICODE. There is probably some bug in auto_link.hpp (when it generate library name and link it => some link mismach in boost STL raised). My tricky solution is: Turn off auto_link by statement before include program_option.hpp: #define BOOST_PROGRAM_OPTIONS_NO_LIB ON #include <boost/program_options.hpp> And link library which you need manually (probably libboost_program_options-vc80-mt-gd-1_34.lib) by option Link\Input\additional dependency. There is a paradox: same library as is normaly included by auto_link can be used to include by MSVC option and then all see OK with no assertion. Pavel


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