user2035796
user2035796

Reputation: 67

Compiling in OpenCV

Every time I try to compile this code in OpenCV, I keep getting this error. All I want to do is create a window:

//#include <iostream>
//#include <stdio.h>
#include "highgui.h"

int main() {
    int cvNamedWindow(const char* name, int flags = CV_WINDOW_AUTOSIZE);
    {
        cvNamedWindow("sample");
    }
    cvDestroyWindow("sample");    
}

However I'm getting this error:

window.cpp:4:21: fatal error: highgui.h: No such file or directory

I have checked in the necessary folder and highgui.h is very much installed.

Any help?

Upvotes: 1

Views: 18071

Answers (2)

TOTA
TOTA

Reputation: 402

If you have the OpenCV include as part of the include path, it should be

#include "opencv/highgui.h"

or

#include "opencv2/highgui/highgui.hpp"

depending on you using the c or c++

Upvotes: 1

Froyo
Froyo

Reputation: 18487

Include files as following

#include "opencv2/highgui/highgui.hpp"

And compile the file

g++ -ggdb `pkg-config --cflags opencv` filename `pkg-config --libs opencv`

Upvotes: 1

Related Questions