在iOS本机SDK中导入的QT库

时间:2019-05-02 06:34:48

标签: c++ swift qt qml

因此,此项目的计划是要有一个可在本机SDK中使用的QT库。 我们已经完成了一个模拟库,当将其导入QT App Buit到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)

The current linker flags

项目外观:

The project structure.

有人知道发生了什么吗?

1 个答案:

答案 0 :(得分:1)

您缺少指向libqtpcre2的链接

添加

-lqtpcre2 

进入xcode的“构建设置”中的“其他链接标志”