LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to solve errors while compiling opencv program with header file? like g++ `pkg-c (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-solve-errors-while-compiling-opencv-program-with-header-file-like-g-%60pkg-c-937374/)

prithvi_patel 03-31-2012 03:33 AM

how to solve errors while compiling opencv program with header file? like g++ `pkg-c
 
prithvi@~ $g++ `pkg-config opencv --cflags --libs` ic.c -o ic
In file included from ic.c:1:
/usr/local/include/opencv/highgui.h:45:33: error: opencv2/core/core_c.h: No such file or directory
/usr/local/include/opencv/highgui.h:46:33: error: opencv2/core/core.hpp: No such file or directory
/usr/local/include/opencv/highgui.h:47:39: error: opencv2/highgui/highgui_c.h: No such file or directory
/usr/local/include/opencv/highgui.h:48:39: error: opencv2/highgui/highgui.hpp: No such file or directory
ic.c: In function ‘int main(int, char**)’:
ic.c:4: error: ‘IplImage’ was not declared in this scope
ic.c:4: error: ‘img’ was not declared in this scope
ic.c:4: error: ‘cvLoadImage’ was not declared in this scope
ic.c:6: error: ‘cvSaveImage’ was not declared in this scope
ic.c:7: error: ‘cvReleaseImage’ was not declared in this scope

John VV 04-05-2012 02:38 AM

Quote:

: No such file or directory
install those headers

the non standard location of the opencv source "/usr/local/include/opencv/"
the header in there is looking in the DEFAULT /usr/include for
"opencv2/highgui/highgui_c.h"
this file is being looked for
/usr/include/opencv2/highgui/highgui_c.h

it is not looking in /usr/local/include/......

you should have a /usr/local/lib/pkgconfig from the source install of opencv to /usr/local

add that location to the $PKG_CONFIG_PATH
add the /usr/local/lib location to the $LD_LIBRARY_PATH
and add the /usr/local/include to your $C_INCLUDE_PATH & $CPLUS_INCLUDE_PATH

i put those in a /etc/bashrc.local file and export the variables


All times are GMT -5. The time now is 11:49 PM.