how to cross-compile opencv cpp source files with CodeSourcery

Hi;

I can cross-compile any c or c++ source file with CodeSourcery for Beaglebone

But, I want to cross- compile opencv c++ source files to place them into beaglebone.

I tried but I faced compilation error (can not find opencv-based header files) .

I there any way to cross- compile opencv source files?

Thanks…

Hi:

Tell gcc where is opencv header in, for example:

$ gcc -I {directory of your opencv headers} -o {binary} your_programm.c

Hi;
my opencv library is on /usr/local/lib
my opencv directory is on /usr/local/include/opencv

I wrote ;

g++ -I/usr/local/include/opencv opencv.cpp -o mycode

but I got this error;

/tmp/ccSN8mc2.o: In function main': opencv.cpp:(.text+0x19): undefined reference to cvLoadImage’
opencv.cpp:(.text+0x31): undefined reference to cvNamedWindow' opencv.cpp:(.text+0x45): undefined reference to cvShowImage’
opencv.cpp:(.text+0x51): undefined reference to cvWaitKey' opencv.cpp:(.text+0x5d): undefined reference to cvReleaseImage’
opencv.cpp:(.text+0x69): undefined reference to `cvDestroyWindow’
collect2: ld returned 1 exit status

How can I solve this?

2012/8/22 Robin Steven <vortune@gmail.com>

Use this command to compile it:
g++ pkg-config –cflags opencv -o main main.c pkg-config –libs opencv
It should ideally work .

Just to confirm if you have followed theses instructions:

sudo gedit /etc/ld.so.conf.d/opencv.conf
/usr/local/lib

sudo gedit /etc/bash.bashrc
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

Hi embedizm,

I am also getting the same error.

Did you solve your problem?