在scilab中加载工具箱时出错

时间:2015-08-24 08:27:02

标签: opencv scilab

我正在尝试使用以下代码

将cpp文件与Scilab 5.5.2链接
// This file is released under the 3-clause BSD license. See COPYING-BSD.
function builder_gw_cpp()   
    WITHOUT_AUTO_PUTLHSVAR = %t; 
    tbx_build_gateway("skeleton_cpp9990", ..    
    ["imread","opencv_imread"], ..
    ["opencv_imread.cpp"], .. 
    get_absolute_file_path("builder_gateway_cpp.sce"),[],"g++ -ggdb `pkg-config --cflags opencv` -o `basename opencv_imread.cpp .cpp` opencv_imread.cpp `pkg-config --libs opencv`");
endfunction

builder_gw_cpp(); 
clear    builder_gw_cpp;    // remove builder_gw_cpp on stack    

当我执行这些命令时:

 1)exec builder_gateway_cpp.sce
 2)exec loader.sce.

我收到这样的错误:

addinter(libskeleton_cpp6969_path + filesep() + 'libskeleton_cpp69690' + getdynlibext(), 'libskeleton_cpp69690', list_functions);
Link failed for dynamic library '/home/tess/work/functions/imcrop//libskeleton_cpp69690.so'.
An error occurred: /home/tess/work/functions/imcrop//libskeleton_cpp69690.so: undefined symbol: _ZN2cv3Mat10deallocateEv
Link failed for dynamic library '/home/tess/work/functions/imcrop//libskeleton_cpp69690.so'.
An error occurred: /home/tess/work/functions/imcrop//libskeleton_cpp69690.so: undefined symbol: _ZN2cv3Mat10deallocateEv
dynlibext(), 'libskeleton_cpp69690', list_functions)
                                                     !--error 236 
addinter: The shared archive was not loaded: (null)
at line      15 of exec file called by :    
exec loader.sce

符号位于libopencv_imgproc中。

  • 如何确保代码找到所需的库?

1 个答案:

答案 0 :(得分:0)

根据您提供的tbx_build_gateway docs

tbx_build_gateway(libname, names, files, [gateway_path [, libs [, ldflags [, cflags [, fflags [, cc [, makename [, ismex]]]]]]]])

libname = "skeleton_cpp9990"
names = "imread", "opencv_imread"
files = opencv_imread.cpp
gateway_path = get_absolute_file_path("builder_gateway_cpp.sce")
libs = []
ldflags= "g++ -ggdb `pkg-config --cflags opencv` -o `basename opencv_imread.cpp .cpp` opencv_imread.cpp `pkg-config --libs opencv`"
cflags = 
fflags = 
cc = 
makename = 
ismex =

我不是tbx_build_gateway的专家,但我可以想象ldflags不是提供构建命令的合适字段,我希望更像以下内容:

libname = "skeleton_cpp9990"
names = "imread", "opencv_imread"
files = opencv_imread.cpp
gateway_path = get_absolute_file_path("builder_gateway_cpp.sce")
libs = ["opencv","opencv_imgproc"]
ldflags= 
cflags = "-ggdb `pkg-config --cflags opencv` -o `basename opencv_imread.cpp .cpp` opencv_imread.cpp `pkg-config`"
fflags = 
cc = "g++"
makename = 
ismex =