title: OpenCV application crash related to libstdc++-6.dll
body: <p>I am an opencv, C++, and eclipse CDT starter. I was following a tutorial to learn opencv. However, although I succeeded in compiling my program, it crashed soon after execution. I read through many related Q&amp;A but didn't get a working solution. Any suggestion is highly appreciated. Below is some specification for your reference:</p>
  
  <h3>System setting</h3>
  
  <ul>
  <li><strong>OS</strong>: 32-bit Windows 7 Professional (virtual machine)</li>
  <li><strong>IDE</strong>: CDT 8.2.0 for Eclipse Kepler</li>
  <li><strong>C/C++ compiler</strong>: mingw32-gcc (4.8.1)</li>
  <li><strong>OpenCV Package</strong>: opencv2.4.6</li>
  </ul>
  
  <h3>Detailed procedure</h3>
  
  <ul>
  <li>Downloaded and extracted Eclipse</li>
  <li>Installed MinGW to C:\MinGW. Set "C:\MinGW\bin" to system path [PATH]</li>
  <li>Downloaded and executed OpenCV to C:\opencv. Set "C:\opencv\build\x86\mingw\bin" to system path [PATH]</li>
  <li>Launched Eclipse and in Eclipse:
  <ul>
  <li><em>File>New>C++ Project</em>: Project name->OpenCVTest, Project Type->Hello World C++ Project, Toolchains->MinGW GCC</li>
  <li><em>Finish</em></li>
  <li>In <em>Project>Properties>C/C++ Build>Settings>Tool Settings>GCC C++ Compiler>Includes>Include paths (-I)</em> I added "C:\opencv\build\include".</li>
  <li>In <em>Project>Properties>C/C++ Build>Settings>Tool Settings>MinGW C++ Linker>Libraries>Libraries (-l)</em> I added opencv_core246, opencv_highgui246, and opencv_imgproc246 one after one.</li>
  <li>In <em>Project>Properties>C/C++ Build>Settings>Tool Settings>MinGW C++ Linker>Libraries>Libraries search path (-L)</em> I added "C:\opencv\build\x86\mingw\lib".</li>
  </ul></li>
  <li><p>Replaced the OpenCVTest.cpp file content with the following content:</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  
  int main( int argc, char** argv )
  {
      if( argc != 2)
      {
       cout &lt;&lt;" Usage: display_image ImageToLoadAndDisplay" &lt;&lt; endl;
       return -1;
      }
  
      Mat image;
      image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
  
      if(! image.data )                              // Check for invalid input
      {
          cout &lt;&lt;  "Could not open or find the image" &lt;&lt; std::endl ;
          return -1;
      }
  
      namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
      imshow( "Display window", image );                   // Show our image inside it.
  
      waitKey(0);                                          // Wait for a keystroke in the window
      return 0;
  }
  </code></pre></li>
  <li><p>Built the project and got the following console output (assumed successful):</p>
  
  <p>Info: Internal Builder is used for build
  g++ "-IC:\opencv\build\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\OpenCVTest.o" "..\src\OpenCVTest.cpp"
  g++ "-LC:\opencv\build\x86\mingw\lib" -o OpenCVTest.exe "src\OpenCVTest.o" -lopencv_core246 -lopencv_highgui246 -lopencv_imgproc246</p></li>
  <li><p>Ran the generated .exe without passing a image path (should be working) and the program crashed with the following prompt:</p>
  
  <p>Problem signature:
    Problem Event Name:   APPCRASH
    Application Name: OpenCVTest.exe
    Application Version:  0.0.0.0
    Application Timestamp:    5230da00
    Fault Module Name:    libstdc++-6.dll
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp:   522c646d
    Exception Code:   c0000005
    Exception Offset: 0001df4b
    OS Version:   6.1.7600.2.0.0.256.48
    Locale ID:    1033
    Additional Information 1: 4c0d
    Additional Information 2: 4c0d4d78887f76d971d5d00f1f20a433
    Additional Information 3: 4c0d
    Additional Information 4: 4c0d4d78887f76d971d5d00f1f20a433</p></li>
  </ul>