5
votes

Today I was debuging my program and suddenly due to power failure, my pc shutdown abnormally. Now when I compile that program, it gives me two errors.

:-1: error: cannot open output file debug\Myprogram.exe: Invalid argument
:-1: error: collect2: ld returned 1 exit status

I cleaned the program, rebuilt it. Ran qmake. Closed the compiler and relaunched to compile program by first running qmake, then debugging but worthless. The program isn't getting compiled. I am a beginner and don't have much knowledge about these problems so bear this question. :). How can i fix it.

3
Manually delete everything in the debug (and temp) folders - don't trust the 'clean' command if you think somethign is corruptMartin Beckett

3 Answers

2
votes

Delete entire shadow build directory if you are using shadow build (default build setting is shadow build), then launch QtCreator and try to build.

0
votes

The debugger has probably put a lock on the file/directory that has not been released due to the power failure. Try to remove the Debug folder or use a tool (like this one) to unlock the directory.

0
votes

Sometimes exes will be running already. if that is the case You have to go to Application output tab of Qt Creator and close running executables then it will work.