I'm trying to write a simple C++ function (not even a class) containing
some OpenCV code, to be called from within my Go program. Unfortunately,
much of the "good stuff" in OpenCV is C++ only.
Currently, my C++ file (let's call it ocv.cc) has said function in it; a
header file (ocv.h) contains a single line with the function name. I added
a ocv.swigcxx file which simply reads in a verbatim copy of the includes
and the header file (%include "ocv.h"). All three files are in a
subdirectory of my Go stuff.
My Go code imports that subdirectory and calls the C++ function. I can call
the usual go build [projectname] and go takes care of all the SWIG stuff
for me. I'm blown away. As long as I don't make any OpenCV calls in the C++
function, it actually works flawlessly.
Upon calling OpenCV functions, however, I get runtime errors like
/home/sebastian/go/bin/prjk: symbol lookup error:
undefined symbol: _ZN2cv6imreadERKSsi
Examples of non-trivial Go/SWIG/C++ configurations are pretty much
non-existent :(, and so I don't know what to do. The official docs aren't
helpful -- I've tried going through the SWIG steps myself (as shown in the
SWIG docs) but have had no luck so far. I would imagine that I have to
indicate somewhere that I'd like to link to the
/usr/local/lib/libopencv*.so files, but I don't know where.
I'd appreciate your help!
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.