“ld:重复符号” XCode交叉编译的问题
我正在尝试为iOS(在Windows中编写)交叉编译一个基于openCV的项目。然后我尝试将这些交叉编译的 openCV 库用于特定应用程序(称为 testApp)。
我第一次能够成功地为 iOS 交叉编译 openCV。然后我使用这些库创建了另一个名为 testLib.a 的库,该库由应用程序 testApp 使用(也使用了一些 openCV 功能)。
testLib.a 编译成功,但是对于 testApp,我必须添加对 testLib.a 和 openCV 库(.a 文件)的依赖项。当我尝试编译 testApp 时,出现以下错误 -
ld:重复符号 cv::split(cv::Mat const&, cv::Mat*) /Users/suri/Projects/testLib/lib/Debug/libopencv_core.a(convert.o) 和 /Users/suri/Projects/testApp/libs/testLib.a(convert.o) 为 i386架构
我可以看到这个错误可能会出现,因为 openCV 库是由 open testLib 和 testApp 添加的。我的问题是我应该尝试重新组织项目还是有其他方法来解决这个问题?
我试图找到 testLib 中实际使用“split”函数的位置,但它似乎没有被调用。另外,我检查了 testLib 和 testApp 中的每个 .h,它们都有一个“ifndef”宏。
I am trying to cross-compile a project for the iOS (which is written in windows) and is based on openCV. And then I am trying to use these cross-compiled openCV libs for a specific application (called testApp).
I was first able to successfully cross-compile openCV for the iOS. Then I used these libraries to created another library called testLib.a which was consumed by an application testApp (which also used some openCV functionality).
The testLib.a compiled successfully but, for the testApp I had to add dependency to both testLib.a and the openCV libs (.a files). When I try to compile testApp, I get the following error -
ld: duplicate symbol cv::split(cv::Mat const&, cv::Mat*) in
/Users/suri/Projects/testLib/lib/Debug/libopencv_core.a(convert.o) and
/Users/suri/Projects/testApp/libs/testLib.a(convert.o) for
architecture i386
I can see that this error is probably coming because the openCV libs are added by open testLib as well as testApp. My question is should I try and reorganize the project or is there some other way to fix this issue?
I tried to find where the "split" function might actually be used in testLib but it does not seem to be called. Also, I have checked and every .h in the testLib as well as testApp and they all have a "ifndef" macro.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论