“ld:重复符号” XCode交叉编译的问题

发布于 2024-12-24 23:33:09 字数 716 浏览 0 评论 0原文

我正在尝试为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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文