title: OpenCV program cannot run because of missing "libgcc_s_dw2-1.dll" in Code::Block
body: <p>I write a simple OpenCV program that tries to open an image "kindle-fire-hd.jpg" in the same directory. The IDE is Code::Block and the version OpenCV is 2.4.2 and the compiler is MinGW which is attached as the component of Code::Block. The code is shown here:</p>
  
  <pre><code>#include "opencv2/highgui/highgui.hpp"
  #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  
  int main(int argc, char** argv)
  {
    Mat im = imread(argc == 2 ? argv[1] : "kindle-fire-hd.jpg", 1);
    if (im.empty())
    {
      cout &lt;&lt; "Cannot open image!" &lt;&lt; endl;
      return -1;
    }
  
    imshow("image", im);
    waitKey(0);
  
    return 0;
  }
  </code></pre>
  
  <p>It can be built and compiled correctly (without any error and warning messages) and I have configured the Code::Block as that said in <a href="https://stackoverflow.com/questions/10860352/getting-started-with-opencv-2-4-and-mingw-on-windows-7">Getting started with OpenCV 2.4 and MinGW on Windows 7</a> . </p>
  
  <p>However, when I "run" this program. it shows a "missing libgcc_s_dw2-1.dll" message.</p>
  
  <p><img src="https://i.stack.imgur.com/l2cz6.png" alt="&quot;missing libgcc_s_dw2-1.dll&quot; message window"></p>
  
  <p>And, when I click the "OK" button, the console window shows the following message:</p>
  
  <p><img src="https://i.stack.imgur.com/CYAjc.png" alt="console, error code window"></p>
  
  <p>I tried to search the related Questions on stackoverflow but all their solutions cannot fix this problem. Thanks.</p>