[solved] Have to clean and rebuild "every 30 seconds"



  • I've read so many threads with the same error but I couldn't figure out what is the problem. If I want to run my program after small change to the code, it says:

    bq. error: cannot open output file debug/OnTime.exe: Permission denied
    error: collect2: ld returned 1 exit status

    (the whole Compile Output:
    @Running build steps for project OnTime...
    Configuration unchanged, skipping qmake step.
    Starting: "C:\Qt\qtcreator-2.1.84\mingw\bin\mingw32-make.exe"
    C:/Qt/qtcreator-2.1.84/mingw/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory C:/Coding/Qt/OnTime-build-simulator' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DNETWORKACCESS -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../QtSDK/Simulator/Qt/mingw/include/QtCore' -I'../../../QtSDK/Simulator/Qt/mingw/include/QtNetwork' -I'../../../QtSDK/Simulator/Qt/mingw/include/QtGui' -I'../../../QtSDK/Simulator/Qt/mingw/include/QtSql' -I'../../../QtSDK/Simulator/Qt/mingw/include' -I'c:/QtSDK/Simulator/Qt/mingw/include/QtSystemInfo' -I'c:/QtSDK/Simulator/Qt/mingw/include/QtMobilitySimulator' -I'../../../QtSDK/Simulator/QtMobility/mingw/include' -I'../../../QtSDK/Simulator/QtMobility/mingw/include/QtMobility' -I'../../../QtSDK/Simulator/QtMobility/mingw/include/QtSystemInfo' -I'../../../QtSDK/Simulator/Qt/mingw/include/ActiveQt' -I'debug' -I'.' -I'../OnTime' -I'.' -I'../../../QtSDK/Simulator/Qt/mingw/mkspecs/win32-g++' -o debug/mainwindow.o ../OnTime/mainwindow.cpp g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug/OnTime.exe debug/main.o debug/mainwindow.o debug/findlocation.o debug/moc_mainwindow.o -L'c:/QtSDK/Simulator/Qt/mingw/lib' -lmingw32 -lqtmaind -LC:\QtSDK\Simulator\QtMobility\mingw\lib -lQtMobilitySimulatord1 -lQtSystemInfod1 -lQtSqld4 -lQtGuid4 -lQtNetworkd4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib mingw32-make[1]: Leaving directoryC:/Coding/Qt/OnTime-build-simulator'
    c:/qt/qtcreator-2.1.84/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot open output file debug/OnTime.exe: Permission denied
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug/OnTime.exe] Error 1
    mingw32-make: *** [debug] Error 2
    The process "C:\Qt\qtcreator-2.1.84\mingw\bin\mingw32-make.exe" exited with code 2.
    Error while building project OnTime (target: Qt Simulator)
    When executing build step 'Make'
    @)

    The only way to run it properly is to Clean the project and then build it again.

    What could be a reason for this problem?

    I suppose the mistake is mine so here is the source code: "github repo":https://github.com/SecretNinja/OnTime

    I'm using: Windows 7, QtCreator 2.2 RC1, QtSDK1.1 RC.

    P.S. I wasn't sure where to put the thread ... but the the app is supposed to be for Symbian phone so I decide that here it would be OK.



  • "Permission denied" for exe files under windows mean only one - this exe now running. You sure your app is terminating correctly?



  • Yeah make sure you terminate the previous running instance of your app. This file locking on windows is a PITA.



  • bq. C:\Coding\Qt\OnTime-build-simulator\debug\OnTime.exe exited with code 0

    There is no sign that the program is still running - it isn't in Task Mannager, the QtSimulator is stopped.

    If I execute "Build -> Run qmake" after this error and then try to run the project, the error is gone away (but I think that this isn't a general solution - yesterday it didn't help every time).



  • You can use "ProcessExplorer":http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx to find which process has the file handle to your file open. I think it is Ctrl-F then enter name of file to search for what has it open.



  • The process is "System" and when I try to close the handle - it says "The handle is invalid"
    ... I 'love' you Windows :(



  • System?
    what do you mean by "the process is system"?
    is there a process OnTime.exe?



  • No, there isn't OnTime.exe .

    In Task Manager there is a process named "System".

    Screenshot from ProcessExplorer: !http://img560.imageshack.us/img560/8646/systems.png( ProcessExplorer )!



  • Do you have windows explorer open in that directory by any chance? If so try closing that.



  • This was one of the first things I tried. After restart and even manually closing all unnecessary processes the problem is still here.

    Under Linux it's OK ... but this isn't a real solution.

    Could be a problem my local git repo? ... I will try making new project without it.

    EDIT:

    Git is not a problem. I've had the same problem without git. Then I decided to start a totally new project ... adding a textEdit, a button and one line of code

    @ui->textEdit->setText("1");@

    is OK ... but adding another one and trying to run again the 'app'

    @ui->textEdit->setText("1");
    ui->textEdit->setText("2");@

    stop the execution with the same error.

    ONE MORE EDIT:

    Unfortunately the problem is in Windows and Qt is not to be blamed ( this isn't bad but my chances to find a solution are smaller ).
    Here is the absolutely "the same problem like mine":http://forum.sysinternals.com/system-process-anomaly_topic24458.html :

    bq. Problem: after the proper execution and termination of an executable the System process (PID: 4) keeps a handle to the file for minutes even after the termination of the executable and this blocks me from deleting, moving the given executable.



  • The problem was that "Application Experience" service was stopped. I just have to re-enable it.

    The strange part is that when the problem started I'm sure that I was writing code and not stopping services ... Windows.

    What this service is doing:

    bq. Processes application compatibility cache requests for applications as they are launched.

    (no comment)

    Thanks to everybody :)

    /off I am writing the solution in a new post because the previous was already too long and to be more obvious what somebody have to do. Was this correct or should I edit my last post (if it is the last in the thread of course) next time?



  • [quote author="secretNinja" date="1303562839"]

    /off I am writing the solution in a new post because the previous was already too long and to be more obvious what somebody have to do. Was this correct or should I edit my last post (if it is the last in the thread of course) next time?[/quote]

    I think edits are done when you are editing your own post; when you have completely different topic and too long to embed in one post (like, 5-10 paragraphs) or like now, when you are answering your own question.

    It makes much easier for others to understand actual problem when they are naturally reading the question and then answer to it, regardless who is answering to it.

    EDIT: Edits, on the other hand, are often used like now, when I saw I shouldn’t have quoted whole post but only offtopic part of it :)



  • "/off I am writing the solution in a new post because the previous was already too long and to be more obvious what somebody have to do. Was this correct or should I edit my last post (if it is the last in the thread of course) next time?"

    --> could you please mention where the new post with the solution can be found?
    Thank you!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.