应用程序文件没有在不同的mac上运行

app-file not running on different mac

本文关键字:mac 运行 文件 应用程序      更新时间:2023-10-16

我用Qt创建了一个应用程序文件。它包含openGL、Qt和c++代码。

我的专业文件如下:

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += openglscene.h 
glwidget.h 
QT += opengl
OTHER_FILES +=
RESOURCES += 
    images.qrc
mac: LIBS += -framework GLUT
else:unix|win32: LIBS += -lGLUT
FORMS +=

当我试图在不同的mac上运行应用程序文件时,我收到以下错误消息:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded:    /Developer/QtSDK/Desktop/Qt/473/gcc/lib/QtOpenGL.framework/Versions/Current/QtOpenGL
  Referenced from: /Users/USER/Desktop/*/model.app/Contents/MacOS/model
  Reason: image not found

其他Mac电脑没有安装Qt。似乎我需要以某种方式包含一个openGL框架。如何才能让我的应用程序的其他用户能够使用它?

您需要在应用程序捆绑包中包含所有应用程序的依赖项,包括Qt。qmake不会自己处理这个问题。Qt附带了一个小工具macdeployqt,它可以满足您的需要。一个更复杂的解决方案是使用CMake和DeployQt4.cmake