Ask Your Question
0

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

asked 2015-01-18 07:40:43 -0500

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

edit retag flag offensive close merge delete

Comments

1

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

berak gravatar imageberak ( 2015-01-18 07:49:04 -0500 )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 ( 2015-01-18 07:57:53 -0500 )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 ( 2015-01-18 08:11:47 -0500 )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 ( 2015-01-18 08:24:20 -0500 )edit

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

sid gravatar imagesid ( 2015-01-18 08:34:12 -0500 )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 ( 2015-01-18 08:36:47 -0500 )edit

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

sid gravatar imagesid ( 2015-01-18 08:42:30 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2015-01-18 08:52:49 -0500

updated 2015-01-18 08:54:30 -0500

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

edit flag offensive delete link more

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 ( 2015-01-18 08:56:45 -0500 )edit

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

sid gravatar imagesid ( 2015-01-18 08:57:40 -0500 )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 ( 2015-01-18 09:07:01 -0500 )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 ( 2015-01-18 09:28:06 -0500 )edit
1

answered 2015-01-18 09:24:12 -0500

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-01-18 07:40:43 -0500

Seen: 28,807 times

Last updated: Jan 18 '15