PDA

View Full Version : error ":: error: cannot open output file debug\assign2_9.exe: Permission denied"



ayanda83
23rd August 2012, 22:39
My program ran about three time but when I ran it the forth time it gave the error ":: error: cannot open output file debug\assign2_9.exe: Permission denied" ":: error: collect2: ld returned 1 exit status". I did not change anything in the code. WHATS CAUSING THIS ERROR PLEASE HELP!

spirit
24th August 2012, 08:36
Looks like an executable was already started, but not closed.

ChrisW67
24th August 2012, 09:10
Windows locks executables when they are running. When the application is running during a build the linker cannot replace the executable and fails in the fashion you describe.

8Observer8
14th August 2014, 09:13
Hello! I have a same problem. I must open every time "Task Manager" for ending task. For example, I created the simple application with a dialog:



#include "Dialog.h"
#include <QApplication>
#include <QMessageBox>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

app.setApplicationName( "Single Point" );
app.setApplicationVersion( "0.1" );

#ifndef QT_NO_OPENGL
Dialog w;
w.show();
#else
QMessageBox::information( NULL, "Error", "OpenGL support required");
#endif

return app.exec();
}


I receive:

error: cannot open output file debug/SinglePoint.exe: Permission denied

ChrisW67
14th August 2014, 22:39
I assume you are seeing the modal message box, closing that, and having the program fall through to the main event loop. The program stays running in that case. Try this:


#include "Dialog.h"
#include <QApplication>
#include <QMessageBox>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

app.setApplicationName( "Single Point" );
app.setApplicationVersion( "0.1" );

#ifndef QT_NO_OPENGL
Dialog w;
w.show();
return app.exec();
#else
QMessageBox::information( NULL, "Error", "OpenGL support required");
return 1;
#endif
}

8Observer8
15th August 2014, 04:04
Thank you very much for your help :D