使用QProcess运行另一个基于Qt的应用程序(运行非基于Qt的程序就好了)

时间:2014-04-22 19:28:23

标签: c++ qt qprocess

我使用QProcess来运行其他非基于Qt的程序,它们都运行良好。 App1尝试调用位于App1.app/Contents/deps的App2。它调用的其他程序也位于该目录中。如果我从finder或QtCreator运行App2,它可以正常工作。但是当我尝试使用QProcess运行它时,我得到了这个错误:

objc[7817]: Class NotificationReceiver is implemented in both /Users/USER/gui/App1Bin/App1.app/Contents/deps/App2.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets and /Users/USER/Qt5.2.1/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.

QObject::moveToThread: Current thread (0x1013000c0) is not the object's thread (0x101210d60).
Cannot move to target thread (0x1013000c0)

On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt platform plugin "cocoa".

Available platform plugins are: cocoa, minimal, offscreen.

Reinstalling the application may fix this problem.

我正在使用macdeployqt来部署App1和App2。

我使用process->start(cmd, options)来调用它。

1 个答案:

答案 0 :(得分:0)

我无法弄清楚为什么我无法使用QProcess打开App2,但我发现我可以使用QProcess调用的open命令打开它。