Ask Your Question
0

Error while running the program : "program has stopped working"

asked 2018-10-02 08:23:35 -0600

vivkv gravatar image

I built OpenCV 4.0.0-pre from source using MinGW (tdm-1) 5.1.0 which was shipped along with codeblocks. My build and install were successful on windows 10. image

Now, to check my built library I ran a sample program,

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;
using namespace std;

int main( )
{    
  // Create black empty images
  Mat image = Mat::zeros( 400, 400, CV_8UC3 );

  // Draw a line 
  line( image, Point( 15, 20 ), Point( 70, 50), Scalar( 110, 220, 0 ),  2, 8 );
  imshow("Image",image);
  cout<<"******************";
  waitKey( 0 );
  return(0);
}

Using below command I can compile my program and get the executable

g++ -std=c++11 OpenCVTest.cpp -llibopencv_core400 -llibopencv_highgui400 -llibopencv_imgproc400

But on running the program, I am getting program has stopped working pop up. image

Had raised this issue on OpenCV Github repo but didn't got any answer. github issue

Any help would be appreciated. Thanks..

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-10-02 08:42:08 -0600

berak gravatar image

updated 2018-10-02 08:43:31 -0600

using MinGW (tdm-1) 5.1.0 which was shipped along with codeblocks.

that's usually an unfortunate decision, it's amazing, that it even compiled. (that's 32bit only, right ?)

imho you should try to get a more modern mingw64 (it all works nicely here, using mingw64 7.2.0, the seh version)

and rebuild the opencv libs using cmake flags:

 -DENABLE_PRECOMPILED_HEADERS=OFF
 -DWITH_MSMF=OFF
 -DWITH_IPP=OFF
 -DCPU_DISPATCH=""       (leave empty)

good luck !

edit flag offensive delete link more

Comments

Hi Berak, I followed the same configuration: 1. Installed Mingw-w64 x86_64 7.2.0 2. Downloaded Opencv 4.0 source 3. Disabled all the cmake flags as you said but I am getting error on running ming32-make command

error: In file included from D:\Programs\OpenCV-Source\opencv-4.0.0\opencv-4.0.0\modules\core\src\precomp.hpp:49:0, from D:\Programs\OpenCV-Source\opencv-4.0.0\opencv-4.0.0\modules\core\src\algorithm.cpp:43: D:/Programs/OpenCV-Source/opencv-4.0.0/opencv-4.0.0/modules/core/include/opencv2/core/utility.hpp:697:14: error: 'recursive_mutex' in namespace 'std' does not name a type typedef std::recursive_mutex Mutex; ^~~~~~~~~~~~~~~ D:/Programs/OpenCV-Source/opencv-4.0.0/opencv-4.0.0/modules/core/include/opencv2/core/utility.hpp:698:29: error: ...

vivkv gravatar imagevivkv ( 2019-03-09 12:36:16 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-10-02 08:23:35 -0600

Seen: 401 times

Last updated: Oct 02 '18