在构建我的 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/