View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-31-2012, 04:33 AM   #1
LQ Newbie
Registered: Mar 2012
Location: mahesana, Gujarat. India
Posts: 1

Rep: Reputation: Disabled
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
Old 04-05-2012, 03:38 AM   #2
John VV
LQ Muse
Registered: Aug 2005
Posts: 15,894

Rep: Reputation: Disabled
: 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
this file is being looked for

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
c program compiling with header file ant___man Programming 4 12-15-2011 04:53 PM
while compiling c programme it's showing errors in header files mprabu20 Programming 1 04-08-2006 03:07 AM
Missing header GLTK in compiling an openGL program BorgAssimilator Programming 1 01-23-2006 10:07 PM
how to solve parse errors in C program?? divya Linux - Software 4 04-01-2004 12:19 PM

All times are GMT -5. The time now is 03:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration