Compiling prgram with OpenCV in Linux

asked 2013-09-18 12:24:51 -0500

mainul gravatar image

updated 2013-09-18 12:44:12 -0500

berak gravatar image

Hi I created a program using OpenCV in windows with visual studio. My program has two cpp files. Both of them include many library files. The main function is in detect.cpp file and the other file is lbp.cpp. In windows the program runs just fine and can get every library files and header files. But when I tried to compile the program in Linux it did not compile and gave me error. For simplicity I put the both the cpp files in the same directory and placed this directory in opencv samples folder. But when I tried to compile I got this error:

fatal error: precomp.hpp: No such file or directory

But this file is there in /modules/core/src folder. I am not sure why it cannot find the file. How can I pass the file location while compiling? can anyone suggest me some tutorial how I can compile my code? I searched some articles but they are not helping.


edit retag flag offensive close merge delete



precomp.hpp is an internal header, not meant to be used outside the library in the first place.

why is your code dependant on it ?

berak gravatar imageberak ( 2013-09-18 12:47:43 -0500 )edit

The original haar.cpp file has that header file and as my lbp.cpp also quite similar to haar I kept it. However, removing the header line or placing lbp.cpp file in teh same location as haar.cpp gives me some different error. It says that some functions are not declared in the scope. My question is if you have a main file and a function file both of which use OpenCV and OpenCL, how will you compile that code? Any help will be appreciated.

mainul gravatar imagemainul ( 2013-09-18 13:40:33 -0500 )edit