在 QtCreator 中使用“发布”设置构建的应用程序构建并运行良好。使用“调试”构建/运行代码在应用程序启动时失败,控制台和崩溃报告出现以下错误。
构建信息:
Qt Creator 4.2.2
Based on Qt 5.8.0 (Clang 7.0 (Apple), 64 bit)
Erstellt am Apr 3 2017 04:09:42
Revision 991f5eb6a5
控制台输出:
QML debugging is enabled. Only use this in a safe environment.
dyld: lazy symbol binding failed: Symbol not found: __ZN9QCFString9toQStringEPK10__CFString
Referenced from: /Users/manuel/projects/rawstack/build-debug/app/rawstack.app/Contents/PlugIns/platforms/libqcocoa.dylib
Expected in: /Users/manuel/Qt/5.8/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug
dyld: Symbol not found: __ZN9QCFString9toQStringEPK10__CFString
Referenced from: /Users/manuel/projects/rawstack/build-debug/app/rawstack.app/Contents/PlugIns/platforms/libqcocoa.dylib
Expected in: /Users/manuel/Qt/5.8/clang_64/lib/QtCore.framework/Versions/5/QtCore_debug
堆栈跟踪 :
1 __abort_with_payload 0x1001089ee
2 abort_with_payload_wrapper_internal 0x10010843b
3 abort_with_payload 0x100108464
4 dyld::halt(const char *) 0x1000e3793
5 dyld::fastBindLazySymbol(ImageLoader * *, unsigned long) 0x1000e389e
6 dyld_stub_binder 0x7fffce62f282
7 None 0x1045f2008
8 ___lldb_unnamed_symbol1006$$libqcocoa.dylib 0x1044cba06
9 ___lldb_unnamed_symbol24$$libqcocoa.dylib 0x104489ef9
10 ___lldb_unnamed_symbol5$$libqcocoa.dylib 0x10448888e
11 QPlatformIntegrationPlugin::create(QString const&, QStringList const&, int&, char * *) qplatformintegrationplugin.cpp 64 0x1023aa358
12 QPlatformIntegration * qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QStringList const&, int&, char * *&>(QFactoryLoader const *, QString const&, QStringList const&&&, int&&&, char * *&&&) qfactoryloader_p.h 101 0x1023a9877
13 QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char * *, QString const&) qplatformintegrationfactory.cpp 71 0x1023a9122
14 init_platform(QString const&, QString const&, QString const&, int&, char * *) qguiapplication.cpp 1115 0x1023b9b0b
15 QGuiApplicationPrivate::createPlatformIntegration() qguiapplication.cpp 1278 0x1023b9906
16 QGuiApplicationPrivate::createEventDispatcher() qguiapplication.cpp 1295 0x1023ba33f
17 QApplicationPrivate::createEventDispatcher() qapplication.cpp 188 0x102bce165
18 QCoreApplicationPrivate::init() qcoreapplication.cpp 787 0x101dd2be5
19 QGuiApplicationPrivate::init() qguiapplication.cpp 1318 0x1023b71d5
20 QApplicationPrivate::init() qapplication.cpp 568 0x102bce7af
使用的编译器:
$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
可能是什么原因 ?如何解决这个问题?