PDA

View Full Version : error: opencv2/core/core_c.h: No such file or directory -- OpenCV 2.4.6 with Q5.1



studentQt
10th September 2013, 19:17
I was trying to write a camera program by watching an example video, when I finished writing codes , builted it then I got a messagge like at the title.

Actually , my problem isn't it.
Fisrt , I made a search in this forum and other sites , I find a solution , it's about the file paths but the problem is that I add the modules path but the problem doesn't solve

about the problem:

content of .pr
INCLUDEPATH += D:\opencv\include
INCLUDEPATH += D:\opencv\modules \
+calib3d\include
+contrib\include
+core\include
+features2d\include
+flann\include
+gpu\include
+highgui\include
+imgproc\include
+legacy\include
+ml\include
+nonfree\include
+objdetect\include
+photo\include
+stitching\include
+superres\include
+video\include
+videostab\include


LIBS += -LD:\opencv\build\x64\mingw\bin \
-Llibopencv_calib3d246.dll
-Llibopencv_contrib246.dll
-Llibopencv_core246.dll
-Llibopencv_features2d246.dll
-Llibopencv_flann246.dll
-Llibopencv_gpu246.dll
-Llibopencv_highgui246.dll
-Llibopencv_imgproc246.dll
-Llibopencv_legacy246.dll
-Llibopencv_ml246.dll
-Llibopencv_nonfree246.dll
-Llibopencv_objdetect246.dll
-Llibopencv_photo246.dll
-Llibopencv_stitching246.dll
-Llibopencv_superres246.dll
-Llibopencv_video246.dll
-Llibopencv_videostab246.dll

heard files on .h

#include <QDialog>
#include <opencv/highgui.h>
#include <opencv/cv.h>

when I clicked the error to find the error line, it shows me highgui.h heard file

1#ifndef __OPENCV_OLD_HIGHGUI_H__
2#define __OPENCV_OLD_HIGHGUI_H__
3
4#include "opencv2/core/core_c.h"
5#include "opencv2/core/core.hpp"
6#include "opencv2/highgui/highgui_c.h"
7#include "opencv2/highgui/highgui.hpp"
8
9#endif

the error line is 4

------------------
I changed the path in the error line (4th) like in "core/include/opencv2/core/core_c.h" way after that time there is another error:

error: opencv2/core/types_c.h: No such file or directory

Now , What are your suggestions?

Thanks for your help

-------------------------------
I added wrong tag in tags box sorry about that

alainstgt
10th September 2013, 23:45
just let your file finder do the job for you.
on my computer, windows explorer found 4 locations of the file types_c.h!

Alain

studentQt
11th September 2013, 00:52
do u think that's the exact solution? I think not

isn't there another suggestion ?

ChrisW67
11th September 2013, 01:14
Your INCLUDEPATH and LIBS continuation lines are all missing the ending backslash.

Your INCLUDEPATH variable makes no sense anyway. What are the "+" symbols supposed to mean?

Your LIBS variable: either list the full path to each library file OR (preferrably) use the -Lsearch_path and -lname form.
Declaring other libraries

Assuming your paths are generally correct then this should do it (these are for the binary install):


INCLUDEPATH += D:/OpenCV/build/include

# One of these variants depending on your compiler
# or an x64 version if you are building 64-bit
#
LIBS += -LD:/opencv/build/x86/vc8/lib
LIBS += -LD:/opencv/build/x86/vc9/lib
LIBS += -LD:/opencv/build/x86/vc10/lib
LIBS += -LD:/opencv/build/x86/mingw/lib

# Add the libraries you actually use with -l options.
LIBS += -lopencv_highgui246 \
-lopencv_imgproc246 \
-lopencv_objdetect246

The exact paths depend on how you installed OpenCV.
At run time the relevant D:/OpenCV/build/x86/compiler/bin directory must be in the PATH for the executable to find the DLLs.

Then in your code:


#include "opencv/cv.h"
#include "opencv/highgui.h"

int main(int argc, char** argv)
{
IplImage* img = cvLoadImage( "image.jpg" );
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Example1" );
return 0;
}

Added after 4 minutes:


do u think that's the exact solution? I think not
isn't there another suggestion ?

No, the exact solution requires you to gain a little understanding how a compiler and linker work together to find required components and build an executable, and how that executable finds the things it needs to run. That has little to do with Qt, however, that understanding quickly resolves exactly the sort of problems you are experiencing here.

studentQt
11th September 2013, 03:09
I tried to write a path for an image but qt gives errors

9566

do u have a suggestion about this?

ChrisW67
11th September 2013, 03:49
The compiler warning on line 8 is because you have an unescaped backslash in the C++ string literal and there is no escape code "\i".

The linker errors are because your LIBS variable is still wrong.

studentQt
11th September 2013, 11:59
my .pro file content



#-------------------------------------------------
#
# Project created by QtCreator 2013-09-11T03:55:37
#
#-------------------------------------------------

QT += core

QT -= gui

TARGET = camera_onConsole
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

INCLUDEPATH += D:\opencv\build\include

LIBS += -LD:\opencv\build\x64\mingw\lib
LIBS += -LD:\opencv\build\v9\mingw\lib
LIBS += -LD:\opencv\build\v10\lib
LIBS += -LD:\opencv\build\v11\mingw\lib

LIBS += -lopencv_highgui246 \
-lopencv_imgproc246 \
-lopencv_objdetect246

SOURCES += main.cpp


waiting to your suggestions

ChrisW67
11th September 2013, 12:21
# One of these variants depending on your compiler
# or an x64 version if you are building 64-bit
#
LIBS += -LD:/opencv/build/x86/vc8/lib
LIBS += -LD:/opencv/build/x86/vc9/lib
LIBS += -LD:/opencv/build/x86/vc10/lib
LIBS += -LD:/opencv/build/x86/mingw/lib



One of these variants, not all of those variants, not random variations on them etc. Above all they should actually match the compiler you are using (vc9, vc10, vc11, or mingw), the architecture you are building for (x86 or x64), and the actual location of the files on you hard drive. In your case I would guess mingw and x86.

You will also note I am using UNIX-style path separators '/' not Windows-style '\'. This avoids the need to constantly escape the backslashes to suppress the warnings that qmake issues (I am sure you have noticed).

studentQt
11th September 2013, 17:55
thanks for all of your helps , I have just one error

9576

9577

now , what should I do?