OpenCV as static library

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

OpenCV as static library

i compiled opencv with cmake/make as a dynamic lib and everything worked fine. Also my programs works without any problems.

Now i want to compile opencv as a static library:
I tried the following out:

1. cmake -DBUILD_SHARED_LIBS=OFF ../opencvsrc
2. make -j8

After that i got the *.a libs in the lib directory without any faults.
When i add the static libs to my codeblocks-project and compile i get some undefined references like:

window_gtk.cpp:(.text._ZL13icvOnKeyPressP10_GtkWidgetP12_GdkEventKeyPv+0x3c)||undefined reference to `g_threads_got_initialized'|

Does anybody have an idea whats going wrong?
Im using ubuntu 10.04.

Reply | Threaded
Open this post in threaded view

Re: OpenCV as static library

Matthias Schmieder
Hi there,
I tried the same some weeks ago with a windows environment and VisualStudio 2008. After fixing an error that was caused by a wrong include (something about "video") I did get OpenCV 2.1 compiled as static lib, though it wasn't working - I had many linker errors when trying to include the libs into an project.

I think that the guys at willowgarage haven't tried to use the static compiled OpenCV library in a long time. Maybe we should send a bug report, that this isn't working anymore.