Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Progam does'nt build in release mode



  • Hello,
    i have the problem that my program does'nt build in release mode. If i build in debug all build fine and the program will be run. If i try to build in release QtCreator says

    EDIT: In the followed Code Snipits i have replaced the Programname with * to avoid misunderstandings i replaced it with [ProgName]

    :-1: Fehler: cannot open output file release[ProgName].exe: Permission denied
    

    I know this error if i forget to close a running instance of the program but this is'nt the case here.

    At a clean build the folowing passage seems the major part of output

    g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\*.exe object_script.[ProgName].Release  -lmingw32 -LC:/Qt/5.5/mingw492_32/lib -lqtmain -lshell32 -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core 
    
    C:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot open output file release\*.exe: Permission denied
    
    collect2.exe: error: ld returned 1 exit status
    
    Makefile.Release:259: recipe for target 'release[ProgName].exe' failed
    

    All object files and moc's are build so i can see but he will does'nt build the executable. How i say above this occure only in release mode. If i compile in debug mode all is fine...

    At a clean up one error occured:

    `D:\Projekte[ProgName]\build\ui_MainWindow.h konnte nicht gefunden werden <- In english "can't find"
    

    I use the QtCreator 4.0.2
    Qt Version 5.5.1 with MinGW 32 bit
    The only think i added to the Project settings is the call of make install

    Here is the .pro file with the relevant parts:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-02-18T15:58:47
    #
    #-------------------------------------------------
    
    QT       += core gui network widgets
    
    TARGET = [ProgName]
    TEMPLATE = app
    
    QMAKE_CXXFLAGS += -std=c++11
    DEFINES = QT_MESSAGELOGCONTEXT
    
    build_pass:CONFIG(debug, debug|release) {
        CONFIG += warn_on
    }
    
    #######################################
    # Deploy Settings
    
    TARGET_CUSTOM_EXT = .exe
    DEPLOY_COMMAND = windeployqt
    
    ProgramData.path = C:\ProgramData[ProgName]
    ProgramData.files += settings.xml
    INSTALLS += ProgramData
    
    CONFIG( debug, debug|release ) {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
    } else {
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
    }
    
    # Uncomment the following line to help debug the deploy command when running qmake
    # warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})
    
    # Use += instead of = if you use multiple QMAKE_POST_LINKs
    QMAKE_POST_LINK += $${DEPLOY_COMMAND} $${DEPLOY_TARGET}
    
    # below the list of files... 
    

    So, i search since some weeks for the error but i don't finde them so i hope here is someone how can help me. If you need more Information let it know me and thank that you read this and try to help me :-)

    best regards


  • Moderators

    @Krenox
    your problem is obviously the * in the line ProgramData.path = C:\ProgramData\* in your .pro-file

    You need to avoid it.



  • @raven-worx
    Sorry that isn't i have only replaced the regular Program Name with * i have changed taht now with some less unclear formulation. But thank you for your help :-)


  • Moderators

    @Krenox
    did you rerun qmake after every change to the pro file?



  • @raven-worx
    Because this problem existet since two month i have run qmake serveral times and it doesnt change the problem. How i say the debug mode compile and i have do sumless rebuilds with clean the build, delete the build order, delete the .pro.user and configure a new project. But nothing of theme help, he will not build the executable in release mode...



  • could you try running uic manually on your .ui file?


  • Moderators

    @Krenox
    you should post the actual contents of your pro file and also the exact error message(s). (Without your substitutions)


Log in to reply