将 OSX 上的 XCode 中的 OIS 与 CMake 链接

发布于 2024-11-17 07:27:13 字数 2172 浏览 1 评论 0原文

我正在创建一个浏览器插件,可以处理所有浏览器和平台上的操纵杆输入。它可以在 Linux 和 Windows 上运行,但我在链接到 XCode 中的 OIS 库时遇到问题。

我已经构建了 OIS 并获取了 libOIS.a 和 OIS.dylib 并将它们与 CMake 链接起来,如下所示:

find_library(CARBON NAMES Carbon)
find_library(IOKIT NAMES IOKit)

target_link_libraries(${PROJECT_NAME}
 ${PLUGIN_INTERNAL_DEPS}
 ${CARBON}
 ${IOKIT}
 "${CMAKE_CURRENT_SOURCE_DIR}/lib/libOIS.a"
)

但每次我尝试使用代码中的 OIS 类并构建项目时,我仍然会收到错误:

ld warning: in /Users/Lana/Documents/STRd6/boomsticks/Boomstick/lib/libOIS.a, missing required architecture x86_64 in file

Undefined symbols:
 "OIS::InputManager::destroyInputSystem(OIS::InputManager*)", referenced from:
     JoysticksHandler::~JoysticksHandler()in Joysticks.o
     JoysticksHandler::~JoysticksHandler()in Joysticks.o
 "OIS::InputManager::createInputSystem(std::multimap<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "OIS::InputManager::enableAddOnFactory(OIS::InputManager::AddOnFactories)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "OIS::InputManager::getNumberOfDevices(OIS::Type)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "typeinfo for OIS::Exception", referenced from:
     GCC_except_table44 in Joysticks.o
 "OIS::InputManager::createInputObject(OIS::Type, bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

我不'我对 XCode 一无所知,但我能够在 Linux 和 Windows 上通过非常相似的过程获得相同的代码构建。

I'm creating a browser plugin that handles joystick input across all browser and platforms. It's working on Linux and Windows, but I'm having trouble linking to the OIS library in XCode.

I've built OIS and get libOIS.a and OIS.dylib and am linking them with CMake as follows:

find_library(CARBON NAMES Carbon)
find_library(IOKIT NAMES IOKit)

target_link_libraries(${PROJECT_NAME}
 ${PLUGIN_INTERNAL_DEPS}
 ${CARBON}
 ${IOKIT}
 "${CMAKE_CURRENT_SOURCE_DIR}/lib/libOIS.a"
)

But I'm still getting errors every time I try to use the OIS classes from my code and build the project:

ld warning: in /Users/Lana/Documents/STRd6/boomsticks/Boomstick/lib/libOIS.a, missing required architecture x86_64 in file

Undefined symbols:
 "OIS::InputManager::destroyInputSystem(OIS::InputManager*)", referenced from:
     JoysticksHandler::~JoysticksHandler()in Joysticks.o
     JoysticksHandler::~JoysticksHandler()in Joysticks.o
 "OIS::InputManager::createInputSystem(std::multimap<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "OIS::InputManager::enableAddOnFactory(OIS::InputManager::AddOnFactories)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "OIS::InputManager::getNumberOfDevices(OIS::Type)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
 "typeinfo for OIS::Exception", referenced from:
     GCC_except_table44 in Joysticks.o
 "OIS::InputManager::createInputObject(OIS::Type, bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
     JoysticksHandler::initialize()       in Joysticks.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I don't know anything about XCode, but I was able to get the same code building with a very similar process on Linux and Windows.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似狗非友 2024-11-24 07:27:13

这里的链接器警告为您提供了一条线索:

ld warning: in /...k/lib/libOIS.a, missing required architecture x86_64 in file

链接器告诉您您正在尝试链接一个没有 x86_64 架构实现的库文件。你是如何建立那个图书馆的?

要么您正在构建通用二进制可执行文件,但 x86_64 版本的符号不存在...或者您可能有一个较新版本的库的头文件,但尚未更新 .a 文件,并且您在应用程序代码中引用的符号不存在于源树中的 .a 文件中......

The linker warning here gives you a clue:

ld warning: in /...k/lib/libOIS.a, missing required architecture x86_64 in file

The linker is telling you that you're trying to link in a library file that has no implementation for the x86_64 architecture. How did you build that library?

Either you're building a universal binary executable, and the symbols are just not there for the x86_64 version... or perhaps you have a header file for a newer version of the library, but have not updated the .a file, and the symbols you reference in your application code just don't exist in the .a file in your source tree...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文