c++ - 在哪里存储用于 OSX 部署的 Qt 导入?

标签 c++ qt macos deployment

我正在准备发布我的 QT 应用程序。 我有一个导入 -> QtDesktop。

我把它放在 Contents/imports 下(dylib 在 Contents/imports/QtDesktop/plugin 下)。

然后我用 install_name_tool -id & -change 修复了它的依赖关系。

启动应用程序时,它一直说“未安装模块“QtDesktop””

有什么问题吗?

最佳答案

看看这个优秀的 link来自诺基亚 Qt 文档。它们描述了您使用 install_name_tool 提到的步骤。但他们建议将插件放在一个略有不同的文件夹中。

Plugins can be put in the Contents/PlugIns section of a bundle. An advantage of using this location is that the plugins will show up in Finder and users can enable and disable them easily. For a Qt program to take advantage of this feature, we must add this call to main():

qApp->setLibraryPath(qApp->applicationDirPath() + "/../PlugIns");

另请查看聪明的 macdeployqt脚本 - 它会自动为你做所有的事情。我已经在一个应用程序中成功地使用了它。

关于c++ - 在哪里存储用于 OSX 部署的 Qt 导入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6755375/

相关文章:

macos - 用于打开新 iTerm 窗口并运行基于变量的命令的 OSX 脚本

macos - 如何在 OS X 上按顺序运行多个脚本文件?

android - 使用dlopen动态加载x86 android .so文件,出现 undefined symbol 错误

c++ - 创建一个 boolean 函数来确定两个数组是否移位等效

c++ - 使用 QStandardItemModel 委托(delegate)删除 QTreeView 中的文本

android - Qt/Android/CMake : Custom AndroidManifest. xml 未考虑在内

c++ - 在qt4中从文件中导入要在UI中填写的条目

c++ - 你如何在一个类中注入(inject)依赖项,它依赖于一个类,它依赖于 C++ 中的另一个类?

c++ - 如何正确初始化一个事件

c++ - 在架构 x86_64 clang : error: linker command failed with exit code 1 (use -v to see invocation) 中找不到符号