Ask Your Question
1

error C1083: Cannot open include file: 'opencv\cv.h': No such file or directory opencv3.0

asked Jan 18 '15

sid gravatar image

I successfully compiled opencv 3.0 with extra modules using cmake . after setting up project for visual studio 2012 windows8 c++ i get the error c1083: cannot open include file opencv\cv.h Even though the intellisense shows opencv and opencv2 folders , but whenever i build it gives me this error. i setup correct system path and everything . Please help. Thank in advance

Preview: (hide)

Comments

1

btw, code that requires the old c-api, might be horribly outdated.

berak gravatar imageberak (Jan 18 '15)edit

Afaik it will be one hell of a job to get th 3.0 API configured with old deprecated code ... what code are you trying to build?

StevenPuttemans gravatar imageStevenPuttemans (Jan 18 '15)edit

simple webcam video stream :

#include<opencv\cv.h>
#include<opencv\highgui.h>
#include<iostream>
using namespace std;
char key;
int main()
....
sid gravatar imagesid (Jan 18 '15)edit

This is NOT the complete code. But like said before, that is OLD api code for webcam stream. Take a look here as a starter for updated code.

StevenPuttemans gravatar imageStevenPuttemans (Jan 18 '15)edit

still error Error 1 error C1083: Cannot open include file: 'opencv2/objdetect/objdetect.hpp': No such file or director

sid gravatar imagesid (Jan 18 '15)edit

Just adapt to the 3.0 interface now! It is simple, remove the first objectdetect folder! All headers are now directly under the opencv2 folder. So for example 'opencv2\objdetect.hpp'

StevenPuttemans gravatar imageStevenPuttemans (Jan 18 '15)edit

still error Error 1 error C1083: Cannot open include file: 'opencv2\objdetect.hpp': No such file or directory

sid gravatar imagesid (Jan 18 '15)edit

2 answers

Sort by » oldest newest most voted
1

answered Jan 18 '15

updated Jan 18 '15

Okay okay, note to myself: NEVER using only the includes to define good snippets ... let me write one up:

#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;

int main(){
   VideoCapture cap(0);
   Mat new_frame;
   while(true){
      cap >> new_frame;
      if(new_frame.empty()){
         break;
      }
      imshow("camera", new_frame);
      // press ESC to quit software
      if( (int)waitKey(10) == 27 ){
         break;
      }
   }
}

Simply ignore the link I have posted :D

Preview: (hide)

Comments

not working , same error . Error 2 error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory .

My friend compiled using same method as mine , it is working on his pc. not mine :(

sid gravatar imagesid (Jan 18 '15)edit

There could be another problem not API issue. because it is working on my friends pc.

sid gravatar imagesid (Jan 18 '15)edit

Actually if this snippet is not working than 9 chances out of 10, your system does not yet know where the OpenCV installation is located. Can you open up the project properties and look if you actually have linked the OpenCV libraries correctly? Also mentioning what IDE you are using might be good.

StevenPuttemans gravatar imageStevenPuttemans (Jan 18 '15)edit

In windows environments you indeed need a system restart to adapt the paths needed for software. An advantage of Linux is that you can just reload them using command line instructions.

StevenPuttemans gravatar imageStevenPuttemans (Jan 18 '15)edit
1

answered Jan 18 '15

sid gravatar image

Oh , finally done . redefined the system path for DLLs with a system Restart this time , and it worked .sounds like system restart was necassary. any way . Thank you guys for helping me out.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jan 18 '15

Seen: 38,003 times

Last updated: Jan 18 '15