无法启动程序。路径或权限错误?在 Qt 中
我已经下载了 Qt Mobility 开源项目。我有一组演示应用程序。当构建它并启动应用程序时,我收到此错误:
启动程序失败。路径或 权限错误?
有人能告诉我这个问题可能是什么吗?
更新:
完整的错误是:
开始 /Users/xxxxx/Qt/qt-mobility-opensource-src-1.0.2/config.app/Contents/MacOS/config... 无法启动程序。路径或 权限错误?
我已包含“.pro”文件内容:
TEMPLATE = app
TARGET = writemessage
QT += gui
include(../examples.pri)
CONFIG += mobility
MOBILITY = messaging
INCLUDEPATH += ../../src/messaging
HEADERS += \
messagesender.h
SOURCES += \
messagesender.cpp\
main.cpp
symbian:TARGET.CAPABILITY = NetworkServices \
LocalServices \
ReadUserData \
WriteUserData \
UserEnvironment \
ReadDeviceData \
WriteDeviceData
I have downloaded Qt Mobility Open source project. I had a set of demo apps. And when built it and started the App, I got this error:
Failed to start program. Path or
permissions wrong?
Can someone tell me what this problem could be?
UPDATE:
The complete error is:
Starting
/Users/xxxxx/Qt/qt-mobility-opensource-src-1.0.2/config.app/Contents/MacOS/config...
Failed to start program. Path or
permissions wrong?
I have include the ".pro" file contents:
TEMPLATE = app
TARGET = writemessage
QT += gui
include(../examples.pri)
CONFIG += mobility
MOBILITY = messaging
INCLUDEPATH += ../../src/messaging
HEADERS += \
messagesender.h
SOURCES += \
messagesender.cpp\
main.cpp
symbian:TARGET.CAPABILITY = NetworkServices \
LocalServices \
ReadUserData \
WriteUserData \
UserEnvironment \
ReadDeviceData \
WriteDeviceData
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我在 Windows 中也遇到了同样的问题。我找到了答案。您需要检查“运行设置”部分中的“工作目录”参数。
我将其更改为与构建目录相同的路径并且它有效。
我以管理员身份运行 QT。
I had the same issue in Windows. I found the answer. You need to check the "Working directory" parameter in "Run Settings" section.
I changed it to the same path as my build directory and it worked.
I was running QT as admin.
我的 mac 默认情况下没有安装 valgrind,所以我必须
返回 QT Creator,然后在“项目”->“运行-> Valgrind 设置
将 Valgrind 可执行文件指向您可以安装的brew版本
通过在命令行中输入
which valgrind
进行查找。最后,由于此处的错误报告,我意识到 valgrind 3.13 有一个错误,并且没有不起作用,valgrind 3.12 也不适用于 Mac,并且 valgrind 不支持 mac os high Sierra。所以在 3.14 到来之前你基本上都不会被发现。
My mac didn't have valgrind installed by default so I had to
Go back to QT Creator, and in Projects -> Run -> Valgrind Settings
Point the Valgrind executable to the brew installed version which you can
find by typing
which valgrind
on the command line.Finally due to the bug report here I realized that valgrind 3.13 has a bug and doesn't work, and valgrind 3.12 also doesn't work on macs, and mac os high sierra isn't supported by valgrind. So you're basically out of look until 3.14 comes around.
我认为您在这里面临的问题要么是可执行文件的用户权限,要么是错误的构建路径。
首先,尝试将“项目”-“常规”-“构建目录”下的构建路径设置为正确的路径。
如果这不起作用,请打开终端,转到构建路径并执行
./QtBuildProgram
如果这不起作用,请查看用户权限
ls -a ./ QtBuildProgram
也许未授予可执行权限,因为您正在另一种用户模式下作为终端仿真器运行 Creator。
可以肯定的是,执行 sudo chmod u+x QtBuildProgram ,然后通过键入 ./QtBuildProgram 来从命令行执行程序。
这还应该允许您从再次使用 QtCreator。
I think the problem you are facing here are either the user rights of the executable or a wrong build path.
First, try setting the build path under 'Projects' - 'General' - Build Directory to a correct path.
If that doesn't work, open the terminal, go to the build path and execute
./QtBuildProgram
If that doesn't work, take a look at the user rights
ls -a ./QtBuildProgram
Maybe the executable rights are not granted because you are running the Creator in another user mode as the terminal emulator.
Just to be sure, execute
sudo chmod u+x QtBuildProgram
and then execute the program from the command line by typing./QtBuildProgram
That should also allow you to run the program from the QtCreator again.
就我而言,这是因为我有一个 32 位 CPU 并且它正在构建 64 位可执行文件。我只是在尝试从命令行运行它之后才发现这一点。
In my case, it was because I have a 32-bit CPU and it was building 64-bit executables. I only figured this out after trying to run it from the command line though.
检查您的运行设置并查看 exe 路径是否存在并且文件是否已在那里构建。如果您运行的是 Windows 7 或 Windows 8,请将 qtcreator 可执行文件的设置设置为“以管理员身份运行”。
Check your run settings and see if the exe path is existing and file is built there. If you are running windows 7 or windows 8, set the qtcreator executable's settings to "Run as administrator".
检查您的防病毒设置。
那是我的问题。
Check your antivirus settings.
That was my issue.
就我而言,此错误是由“运行设置”中“工作目录”路径开头的空格引起的。
In my case this error was caused by a space at the start of "Working directory" path in "Run Settings".
就我而言,此错误是由于防病毒软件阻止运行 exe 文件造成的。我刚刚关闭 Avira Shield 一段时间,它就可以工作了。
In my case, this error was due to antivirus that was blocking to run the exe file. I just turned off the Avira Shield for some time and it worked.
就我而言,这是因为我缺少项目顶部的这两行代码。确保它们上面没有任何空格:
In my case it was because I was missing these two lines of code at the top of the project. Make sure you have them without any space above :