Add Administrator Level Privileges to Your Qt Program

Include the following in your project’s PRO file to have Administrator level privileges added to your program.

Following should be noted while using this:
1. This will only work if you are using a Microsoft Visual C++ compiler and Windows OS
2. Your OS might ask you for Administrator password or confirmation when you try to run your executable. This depends on how your OS is configured.
3. Qt Creator needs to be started as Administrator in order to run a program (for debugging) that has the following lines in its PRO file.

win32-msvc* {
    CONFIG += embed_manifest_exe
    QMAKE_LFLAGS_WINDOWS += $$quote( /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\" )
}


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.