1

I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.

I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."

The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).

I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be) However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).

Could anybody suggest a fix that might get rid of this error?

A few other things to note:

  • I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial

  • I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.

  • I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable

  • I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.

  • I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.

Thanks in advance!

Community
  • 1
  • 1
Logician
  • 93
  • 1
  • 7
  • 1
    have you copied the opencv dll to the same folder of the exe? or added dll folder to PATH? – Miki Oct 15 '15 at 20:53
  • The folder with the .dll's has been added to PATH, yes. I have not tried adding it to Path yet. I will try this. Edit- adding it to the Path variable did not solve the issue. – Logician Oct 15 '15 at 20:57
  • you are not alone: [one](http://stackoverflow.com/questions/29326210/opencv-programs-crash-at-runtime-with-windows-7-and-codeblocks?rq=1) , [two](http://stackoverflow.com/questions/19792650/opencv-application-crashes-at-runtime-with-error-code-0x0000142?rq=1) – Miki Oct 15 '15 at 21:01
  • no clue then, sorry. Or is something messed up with the configuration, or is a CodeBlocks issue. Just out of curiosity, why CB and not Visual Studio? – Miki Oct 15 '15 at 21:07
  • I've used Code::Blocks before when coding at a friend's house, so it was familiar, and the first tutorial I came across was for it. I hadn't really thought about it in detail. Would Visual Studio have been a better choice? – Logician Oct 15 '15 at 21:14
  • 1
    dll issue could be just the tip of an iceberg. Getting mingw to work generally is a dirty process - wastes time and energy! Checking for the dll is a good start though, also see if there are unreachable paths in the include directory – sjsam Oct 15 '15 at 21:14
  • can you compile a simple "Hello world" console program? same with your #includes? when you run the debugger which line does it crash in? – Surt Oct 15 '15 at 21:15
  • @sjsam My lack of experience is causing me to struggle with your advice: 'see if there are unreachable paths in the include directory'. Could you elaborate please? >. – Logician Oct 15 '15 at 21:33
  • @Surt I can indeed compile a simple 'Hello World' (in a separate project) and it also compiles with just the #includes (the rest of the code commented out- I hope that's what you meant). I'm not used to using the debugger but it doesn't appear to crash at any specific line. It reads "During startup program exited with code 0xc00000be. Debugger finished with status 0", or at least that seemed to be the relevant bits. – Logician Oct 15 '15 at 21:34
  • Ok, so answer provided here: http://stackoverflow.com/questions/19792650/opencv-application-crashes-at-runtime-with-error-code-0x0000142?rq=1 worked for me; putting the dll's directly in the build directory. What does this suggest I've done wrong? Can anyone suggest a way to fix it without cluttering the build directory? Also, if this question is answered, should I put an answer below? – Logician Oct 15 '15 at 21:41
  • One possibility is that some include path finds the wrong dll before the one you should have used. – Surt Oct 15 '15 at 21:49
  • @Logician glad you work it out. Please make an answer for that and accept it – Miki Oct 16 '15 at 00:30
  • @Logician: glad that it worked out. May I know which libraries were copied to the build directory? Is it a static one(.lib) or a dynmic one(.dll)? – sjsam Oct 16 '15 at 04:37
  • @sjsam the dynamic, it seems. Does that imply it's a problem with the PATH variable, then, since that leads to the folder that includes those? – Logician Oct 16 '15 at 14:34
  • Well, it could be. Please figure out how you could include additional link library directories in code blocks – sjsam Oct 16 '15 at 14:56

1 Answers1

3

So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).

Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.

However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.

Logician
  • 93
  • 1
  • 7