Qt: Cannot execute '': The requested operation requires elevation

拥有回忆 提交于 2021-01-27 03:54:49

问题


I am not able to run the application the Qt creator. It complains the following error:

Cannot execute '': The requested operation requires elevation

My .exe file has a Windows administrator shield symbol on it. Do I need to make a project settings changes? I am extensively using Qt File library for doing some file operations.


回答1:


What's your executable's file name? Without an embedded manifest, windows tries to be smart and wants to run executables with "install", "update", "setup", "patch", etc. in the file name as administrator. It even checks for those names within words such as "autoupdate".

The problem is that qmake/mingw doesn't embed those manifests, while MSVC does. If someone has a clean solution to that problem, I'd be interested to learn about it.




回答2:


If application you develop require administrator privileges, you cannot simply run it from Qt creator, started under non privileged account.

You can run your Qt creator as Administrtor.

Or you can start your application from QtCreator using runas utility. But in this case you would not be able to see debug output in QtCreator console window and debug application.




回答3:


If the name of the exe file has some words (update, patch, ...), the Windows UAC ask for admin privilegies. The only solution is that the project generates an exe without these words.

See this: Qt Creator create exes with admin privilegies



来源:https://stackoverflow.com/questions/10215934/qt-cannot-execute-the-requested-operation-requires-elevation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!