c++ - iOS原生sdk中导入的QT库
问题描述
所以这个项目的计划是有一个可以在原生 SDK 中使用的 QT 库。我们已经完成了一个模拟库,当在 QT 应用程序中导入到 xcodeproj 中时,它可以正常工作。
该库是静态的,运行 lipo -info 返回 x86_64 arm64。
我使用了来自https://alediaferia.com/2014/12/18/a-native-ios-app-with-a-qt-third-party-library/的教程,但卡住了。经过一番挖掘,我到达了发生链接的步骤,结果如下:
Undefined symbols for architecture arm64:
"_pcre2_match_16", referenced from:
safe_pcre2_match_16(pcre2_real_code_16 const*, unsigned short const*, int, int, int, pcre2_real_match_data_16*, pcre2_real_match_context_16*) in libQt5Core.a(qregularexpression.o)
"_pcre2_match_context_create_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_jit_stack_assign_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_jit_stack_free_16", referenced from:
QThreadStorage<QPcreJitStackPointer*>::deleteData(void*) in libQt5Core.a(qregularexpression.o)
"_pcre2_get_ovector_pointer_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_match_data_free_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_config_16", referenced from:
QRegularExpressionPrivate::getPatternInfo() in libQt5Core.a(qregularexpression.o)
"_pcre2_pattern_info_16", referenced from:
QRegularExpressionPrivate::getPatternInfo() in libQt5Core.a(qregularexpression.o)
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_jit_compile_16", referenced from:
QRegularExpressionPrivate::optimizePattern() in libQt5Core.a(qregularexpression.o)
"_pcre2_match_context_free_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_pcre2_compile_16", referenced from:
QRegularExpressionPrivate::compilePattern() in libQt5Core.a(qregularexpression.o)
"_pcre2_code_free_16", referenced from:
QRegularExpressionPrivate::~QRegularExpressionPrivate() in libQt5Core.a(qregularexpression.o)
QRegularExpressionPrivate::compilePattern() in libQt5Core.a(qregularexpression.o)
"_pcre2_jit_stack_create_16", referenced from:
safe_pcre2_match_16(pcre2_real_code_16 const*, unsigned short const*, int, int, int, pcre2_real_match_data_16*, pcre2_real_match_context_16*) in libQt5Core.a(qregularexpression.o)
"_pcre2_match_data_create_from_pattern_16", referenced from:
QRegularExpressionPrivate::doMatch(QString const&, int, int, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, QRegularExpressionPrivate::CheckSubjectStringOption, QRegularExpressionMatchPrivate const*) const in libQt5Core.a(qregularexpression.o)
"_uncompress", referenced from:
qUncompress(unsigned char const*, int) in libQt5Core.a(qbytearray.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
项目的外观:
有谁知道发生了什么?
解决方案
您缺少与 libqtpcre2 的链接
添加
-lqtpcre2
进入 xcode 的“构建设置”中的“其他链接器标志”
推荐阅读
- node.js - 为什么 axios post 方法在连续 6 次 post 调用后停止工作?
- java - 如果使用 lambda 找不到元素,则将元素添加到列表中
- python - 将花括号添加到 python 的 plotnine 图中
- .net - UWP 中的 .NET MAUI Essentials 身份验证器错误缺少 AppManifest.xml
- python - Python 服务器的问题
- swift - Swift / SwiftNIO / Vapor:EventLoop 中的 wait() 或类似的,相当于 JavaScript 的 Promise.all()
- web-scraping - kimurai gem - 适用于开发,而不是生产 - 错误:参数数量错误(给定 2,预期 1;必需关键字:url)
- javascript - 尝试在 React 中导入导出的接口,但 React 找不到
- android - 如何验证图像视图?
- amazon-web-services - 使用 socket.io 时 Websocket 连接失败