Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost::Program_Options unhandled exception due to access violation
    primarykey
    data
    text
    <p>I have a program that runs fine in DEBUG mode but in RELEASE mode I get an unhandled exception due to an access violation. I'm pretty sure it's not due to null pointers. Here is the call stack:</p> <pre><code>msvcr90d.dll!memchr(unsigned char * buf=0x0000002c, unsigned char chr='', unsigned long cnt=1243588) Line 80 Asm msvcp90d.dll!std::char_traits&lt;char&gt;::find(const char * _First=0x72656d6f, unsigned int _Count=15, const char &amp; _Ch=',') Line 590 + 0x15 bytes C++ msvcp90d.dll!std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::_DebugHeapAllocator&lt;char&gt; &gt;::find(const char * _Ptr=0x0012f9e4, unsigned int _Off=0, unsigned int _Count=1) Line 1796 + 0x2d bytes C++ Program.exe!boost::program_options::option_description::set_name() + 0x61 bytes C++ Program.exe!boost::program_options::option_description::option_description() + 0x90 bytes C++ Program.exe!boost::program_options::options_description_easy_init::operator()() + 0x58 bytes C++ Program.exe!CommandLineInput(int count=2, char * * vector=0x003d3360) Line 191 + 0xac bytes C++ Program.exe!main(int argc=4233952, char * * argv=0x00000002) Line 65535 C++ Program.exe!__tmainCRTStartup() Line 582 + 0x17 bytes C </code></pre> <p>Code:</p> <pre><code>namespace po = boost::program_options; int _tmain(int argc, _TCHAR* argv[]) { try { CommandInput (argc, argv); //get command line input } catch ( std::exception e ) { std::cout &lt;&lt; "WARNING: Exception is thrown" &lt;&lt; std::endl; return 0; } } void CommandInput (int count, _TCHAR* vector[]) { po::options_description desc("Available Parameters"); std::cout &lt;&lt; "\n"; desc.add_options() ("option1", po::value&lt;std::string&gt;(), "description1") ("option2", po::value&lt;std::string&gt;(), "description2") ("option3", po::value&lt;std::string&gt;(), "description3"); /* The code breaks at the above line */ } </code></pre> <p>The exception reads:</p> <pre><code>Unhandled exception at 0x1026f09b (msvcr90d.dll) in Program.exe: 0xC0000005: Access violation reading location 0x72656d6f. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload