1

I am trying to use Open Cv on Visual studio to write c++ code. I tried a lot of ways to reach this goal for 3 days. here is what I did in these days:

**1.download and extract open cv 4.1.1 (C:\opencv).

2.download and install Visual Microsoft Studio 2019.

3.copy the bin directory of open cv to the system variable path. (in my case:"C:\opencv\build\x64\vc15\bin;C:\opencv\build" )

4.add include folder to the project's properties(my project name is opencv): (properties->configuration properties ->edite include directories value to : (C:\opencv\build\include )

5.edite library directory to ( C:\opencv\build\x64\vc15\lib)

6.then in linker menu->inpute->adittional dependancies -> edit its value to "opencv_world411d.lib" .**

now I write a simple code to test open cv:

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

using namespace std;
using namespace cv;

int main() {
    Mat im = imread("cameraman.tiff", 0);
}

this code built correctly but when I run it It doesn't work with error :

Unhandled exception at 0x000007FEBA8D3AE2 (opencv_world411d.dll) in opencv.exe: 0xC000001D: Illegal Instruction.

gfluidimgproc_func.simd.hpp not found You need to find gfluidimgproc_func.simd.hpp to view the source for the current call stack frame

"I added screenshot" error report

also, I tried Cmake too. first, configure and generate OpenCV's source file. second, open the project in Microsoft visual studio and build all then I build the install folder.all has been done successfully.

questions: 1.how can I fix this error to run OpenCV on Microsoft visual studio 2019 ?

  1. does Microsoft visual studio 2019 support open cv 4.1.1? have you tried it? tanks for your attention.

my operation system is: windows 7 intel core i5

Hamid Reza
  • 492
  • 1
  • 4
  • 14
  • 4. I think, you should set `C:\opencv\build\include` (or `C:\opencv\build\include\opencv2`) as your include folder. Nevertheless, the error in fact is strange. You downloaded the Windows pack from the official [OpenCV releases page](https://opencv.org/releases/)? Maybe, just do it again, and re-install OpenCV. Also, as `vc15` indicates, the pre-built OpenCV DLLs were made using Visual Studio 2017 (VS2019 is vc16). Unfortunately, I have Visual Studio 2017 on my current machine, and can't test in detail. – HansHirse Sep 17 '19 at 04:40
  • it was miss typing I just edited my question. I read somewhere its CPU intel problem. do u have additional information? something like sse3 ssse3! – Hamid Reza Sep 17 '19 at 10:47
  • my problem solved follow this link: https://stackoverflow.com/questions/58007793/using-cmake-to-make-a-library-without-sse-support-windows-version/58044006#58044006 – Hamid Reza Sep 30 '19 at 11:13

2 Answers2

0

>>4.add include folder to the project's properties(my project name is opencv): (properties->configuration properties ->edite include directories value to : (C:\opencv\build\x64 )

This is wrong, you should add C:\opencv\build\include and C:\opencv\build\include\opencv2 to the include directories in your case. I test your case on My PC, I use VS2019 and OpenCV4.1.1 to make a test. Your other steps are correct. This step will cause the header file not to be found, so the corresponding function can not be identified and will be displayed as illegal instructions.

Suarez Zhou
  • 174
  • 7
  • tanks for your answer. it was miss typing. I just update my question. I am sry. – Hamid Reza Sep 17 '19 at 10:46
  • @Hamid Reza I tested, and it work properly. If you configure OpenCV library strictly according to your method, there is no problem. C:\OpenCV\opencv\sources\modules\gapi\src\backends\fluid, I find gfluidimgproc_func.simd.hpp in this path. If you don't have this file. Did you download the correct package? – Suarez Zhou Sep 18 '19 at 06:49
  • @Hamid Reza [https://opencv.org/releases/](https://opencv.org/releases/) Download the Window package – Suarez Zhou Sep 18 '19 at 06:56
  • yes I did it, but it doesn't work. I change my windows to 8.1 and it doesn't work. I made my OpenCV folder with CMake. but it does work either. I don't know what can I do. i always take this massage "Unhandled exception at 0x00007FFCFC433AE2 (opencv_world411d.dll) in opencv.exe: 0xC000001D: Illegal Instruction." – Hamid Reza Sep 18 '19 at 20:41
0

I have the same problem and from what I understand it is because we compile in x64 bit and execute it on an old CPU which doesn't support sse3 instructions (in my case an old i5 750). I believe your only solution is to recompile OpenCV either in 32bit or in 64bit with sse3 disabled.

Julien M
  • 657
  • 3
  • 10
  • 40
  • follow this link. my problem solved: https://stackoverflow.com/questions/58007793/using-cmake-to-make-a-library-without-sse-support-windows-version/58044006#58044006 – Hamid Reza Sep 30 '19 at 11:15