I was looking for a C processing image library and find out that OpenCV library was the most convenient (According to people advices). So I decided to install the latest version, but when I tried to include it to my existing GTK+ (C) project, it gave me compiling errors :
undefined reference to cvRound
Exact message is :
$ gcc ./bin/app.o \
$(pkg-config --libs glib-2.0) \
$(pkg-config --libs pango) \
$(pkg-config --libs gtk+-3.0) \
$(pkg-config --libs gmodule-2.0) \
$(pkg-config --libs opencv) -o bin/app
./bin/app.o : Dans la fonction « cvPointFrom32f » :
app.c:(.text+0x557) : référence indéfinie vers « cvRound »
app.c:(.text+0x56d) : référence indéfinie vers « cvRound »
./bin/app.o : Dans la fonction « cvReadInt » :
app.c:(.text+0xe74) : référence indéfinie vers « cvRound »
./bin/app.o : Dans la fonction « cvEllipseBox » :
app.c:(.text+0x10dc) : référence indéfinie vers « cvRound »
app.c:(.text+0x10fe) : référence indéfinie vers « cvRound »
collect2: error: ld a retourné le statut de sortie 1
make: *** [Makefile:38: bin/app] Error 1
So, I wanted to know, what can I do in order to use OpenCV AND GTK+ (As I don't need OpenCV UI because I already have mine) ?
I also tried to remove gcc by g++ (But this does not solve the problem either) and now it compiles, BUT when I try to run my application using :
$ ./app
I got
Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
I think I'm giving up on installing OpenCV to make it works with GTK+...
P.S: If you have any advice or library recommandations (C) I take it.
Your OpenCV version is most likely built using GTK+ 2, so when you link a GTK+ 3 application with OpenCV, symbols conflict. You can't have both versions in the same process, as stated in the error message. So you just need to rebuild OpenCV with GTK+ 3 support enabled.
BTW, you don't need to specify every dependency explicitely when calling pkg-config, just toplevel ones. So $(pkg-config --libs gtk+-3.0 opencv)
should be enough.