我尝试使用Objective sharpie 为OpenCV 3.4的目标c库创建C#绑定(google developer docs,预编译并使用额外模块从源代码构建)但是没有成功。我要么使用错误的sharpie参数,要么编译的opencv2.framework有问题。
工具/版本:
我尝试了以下sharpie参数(当前目录包含opencv2.framework时):
$ sharpie bind -framework opencv2
$ Done. Exiting with error code 1.
error: opencv2: Umbrella header file does not exist: opencv2.framework/Headers/opencv2.h
$
那是因为伞文件是Headers / opencv.hpp。所以我将参数更改为:
$ sharpie bind -fx-umbrella opencv2.framework/Headers/opencv.hpp -framework opencv2
Done. Exiting with error code 1.
error: opencv2: Umbrella header file does not exist: opencv2.framework/Headers/opencv2.h
$
在每个订单中完全被忽略。
我还尝试了很多其他的可能性,例如仅定义.a文件(与使用lipo删除包含的lib)相结合:
$ sharpie bind opencv2.a
Parsing 1 header files...
warning: [SomePath]/opencv2.a: 'linker' input unused [-Wunused-command-line-argument]
warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
warning: argument unused during compilation: '-fno-spell-checking' [-Wunused-command-line-argument]
warning: argument unused during compilation: '-Xclang -detailed-preprocessing-record' [-Wunused-command-line-argument]
error: unable to handle compilation, expected exactly one compiler job in ''
Error while processing [SomePath]/opencv2.a.
Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
$
或直接用以下方式解决伞形标题:
$ sharpie bind Headers/opencv.hpp
失败,因为" opencv2 / ... hpp"找不到文件,因为每个包含的hpp引用" opencv2 /..."结构
答案 0 :(得分:0)
documentation中的事实相当微妙,但是它指出
-framework选项不允许传递显式头文件。
还有
在后台,指定-framework只是一个捷径。
因此,如果需要指定伞头文件,则可以将参数编写为
sharpie bind opencv2.framework/Headers/opencv.hpp -scope opencv2.framework/Headers -c -F .
这使流程开始了,但是前面还有许多其他问题。经过一天的努力,我个人放弃了使用SharpC来与OpenCV一起工作的机会,但是对于走这条路的人来说,这是个好运。