0

I am trying to run this code that should open the webcam and take frames. However, I am getting this error. Cannot open source file "opencv2/highgui/highgui.hpp"

enter image description here

I download opencv and VS15, I followed online guides on how to install opencv 3.1 on VS15 using CMAKE.

However, It gives the error I mentioned above along side some more errors

Cannot open source file "opencv2/highgui/highgui.hpp"

Cannot open source file "opencv2/imgproc/imgproc.hpp"

I am really new to this and it got me frustrated. Any help will be apreciated. Thanks in advance!

Tony Tannous
  • 463
  • 1
  • 10
  • 23
  • 1
    Have you added the _include_ directory? – Miki Feb 09 '16 at 18:21
  • 1
    Possible duplicate of [Where does Visual Studio look for C++ Header files?](http://stackoverflow.com/questions/335408/where-does-visual-studio-look-for-c-header-files) – Miki Feb 09 '16 at 18:22
  • 1
    How do I add the include directory ? I added in linker the opencv2 include path. I am not sure If I did it properly. – Tony Tannous Feb 09 '16 at 18:26
  • 1
    check step 7 [here](http://stackoverflow.com/a/31545237/5008845) – Miki Feb 09 '16 at 18:27
  • Could you post the code instead of a screenshot ? (even if the problem may just be the include search path) – francis Feb 09 '16 at 19:48

2 Answers2

0

I copied the files into the project folder and just included the file names rather than the filepath, then I used tools -> NuGet package manager -> NuGet Package Console and entered PM > Install-Package opencvdefault

0

If you use OpenCV on Windows, VS, I think you had better download opencv.exe and extract and compile automatically.

Add this dll and header file to the VS path. And add opencv path to the system environment, then restart Windows

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Bryan YU
  • 77
  • 11