c++ - 使用 Qt 链接到 iOS 模拟器上的静态库时的不兼容架构

标签 c++ ios qt

在构建我的 Qt 项目(一个 iOS 应用程序)时,我收到一个缺少架构 (i386) 的符号未找到错误。

该项目使用子目录,其中再次包含 2 个自写库和一个链接到它们的应用程序。

经过一番调查后,我发现我的库使用 armv7 和 arm64,而我的应用程序使用 i386。我从中得到的是链接器似乎没有找到具有各自架构的库。

这是我在构建时从编译器得到的:

ld: warning: ld: warning: ignoring file /Users/me/myprojects/build-myproject-iphonesimulator_clang_Qt_5_7_1_for_iOS-Release/install/lib/libwebdav.a, missing required architecture i386 in file /Users/me/myprojects/build-myproject-iphonesimulator_clang_Qt_5_7_1_for_iOS-Release/install/lib/libwebdav.a (2 slices)ignoring file /Users/me/myprojects/build-myproject-iphonesimulator_clang_Qt_5_7_1_for_iOS-Release/install/lib/libcommon.a, missing required architecture i386 in file /Users/me/myprojects/build-myproject-iphonesimulator_clang_Qt_5_7_1_for_iOS-Release/install/lib/libcommon.a (2 slices)

Undefined symbols for architecture i386: "CalendarEvent::staticMetaObject", referenced from: qt_meta_extradata_QMLEventWrapper in moc_qmleventwrapper.o int qRegisterMetaType(char const*, CalendarEvent::APM_TYPE*, QtPrivate::MetaTypeDefinedHelper::Defined) && (!(QMetaTypeId2::IsBuiltIn))>::DefinedType) in moc_qmleventwrapper.o "CalendarEvent::colorHex() const", referenced from: QMLEventWrapper::color() const in qmleventwrapper.o

...

ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

...

** BUILD FAILED ** The following build commands failed: Ld myproject.build/Release-iphonesimulator/myproject.build/Objects-normal/i386/myproject normal i386 (1 failure) make[1]: * [xcodebuild-release-iphonesimulator] Error 65 make: * [sub-app-make_first] Error 2

提前致谢

最佳答案

您正在尝试在支持架构 i386/x86_64(您计算机的处理器)的模拟器上运行它。

解决方法:

在设备而不是模拟器上测试

解决方法:

还为 i386/x86_64 构建所有使用的库。

关于c++ - 使用 Qt 链接到 iOS 模拟器上的静态库时的不兼容架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43936174/

相关文章:

c++ - 生成具有给定分布的字符

iphone - ios sdk如何解析此类数据

c++ - 从 ui 文件中检索 Qwidget

iphone - 如何使用 Interface Builder 在 View 中重新定位和调整 subview 的大小?

c++ - QComboBox 项目文本可以包含 2 种颜色吗?

c++ - 在 C++ 中使用 qt 显示工具栏中图标的状态

c++ - R6010 使用时出错; std::stoi

c++ - 与内置函数的命名冲突?

c++ - 在 C++ 中传递参数时继承类之间的类型转换

ios - 使用 alamofire 在 swift 中创建字典