LINK : fatal error LNK1168: cannot open <Filename>.exe for writing?

Started by
7 comments, last by RobTheBloke 10 years, 7 months ago

I just switched to visual studio professional from express (thank you ISIC). Anyway, i keep getting this error when i run my project. Google said that i should enable the Application Experience service, except windows 8 gives me this error when i try to do that:

---------------------------
Services
---------------------------
Windows could not start the Application Experience service on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.
---------------------------
OK
---------------------------
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
Advertisement
That error is usually generated when the application is still running. Check the Processes view of the Task Manager to see if some process using that image is still running and kill any you find. Alternatively it is possible a virus scanner is spending an awful lot of time with the application (some security solutions will actively upload unknown executables to a remote server for analysis and completely lock the file while they do so).

As a quick test, try changing the output name.

Same problem. Works at first but when i change something and recompile, i get the same error.

Edit: So i just restarted the laptop and the problem went away (why didn't i do that before i don't know). Which is weird since no related processes were open in the task manager.

"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

Same problem. Works at first but when i change something and recompile, i get the same err

As BitMaster pointed out, this error is usually caused from the application running. The reason it is still happening after a recompile is because something is wrong with your code. Is this a Win32 project? If so, when you run it under a debugger and close the window with the "x" button, does the debugger release? If no, how is your window class created? How does your message proc look?

This tends to happen a lot with Win32 code.

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is objectively shit." - L. Spiro

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

"The 'friend' relationship in c++ is the tightest coupling you can give two objects. Friends can reach out and touch your privates." - frob

Same problem. Works at first but when i change something and recompile, i get the same error.

Edit: So i just restarted the laptop and the problem went away (why didn't i do that before i don't know). Which is weird since no related processes were open in the task manager.

This is usually a problem that occurs in Win32 apps, where the app gets sent into an infinite loop when the window has been destroyed. Run it in a debugger, close it, and then 'break' execution (debug->break all in VC++) to find out where it's currently sitting (you might need to jump about in the call stack to find out where that is, because it might be currently within a win32 function).

I rather doubt it's a win32 problem since i've been working on this project for 3 months and the problem just appeared. (All i changed was the speed of the player lol)

"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

Well, you can either check to see if this is what's causing the problem and let us know, or we can keep telling you the same thing.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

I rather doubt it's a win32 problem since i've been working on this project for 3 months and the problem just appeared. (All i changed was the speed of the player lol)

Regardless of what has happened, the cause is usually the same. Your program is staying in an endless loop and is preventing the release of the program by the operating system upon exit. I don't know why it just started happing, however, I can take a few wild guesses depending on what language you are using. For example, one cause I have witnessed in beginner Win32 code done in C is when a game system (player stats in your case) is implemented using pointers. The pointer is initialized somewhere, the pointer is *usually* deleted somewhere. However, somewhere in program execution, the pointer gets reassigned to an object like the window handle. In this scenario, if you reassigned the pointer to the window handle, you will delete the window handle, the Win32 API does not get the chance to delete the handle and release it, and you are stuck in the endless loop RobTheBloke described. This, of course, is one of many, many reasons that causes this, but they usually always relate to an endless loop.

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is objectively shit." - L. Spiro

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

"The 'friend' relationship in c++ is the tightest coupling you can give two objects. Friends can reach out and touch your privates." - frob

I rather doubt it's a win32 problem since i've been working on this project for 3 months and the problem just appeared. (All i changed was the speed of the player lol)

I'd like to introduce you to git, and the nice front end for it, tortoise git. Everytime you make a change that works, commit the changes, and add a little comment describing your change. The next time you think that you've just changed something minor, git should point out that you have infact changed something else as well (and like every human, you've simply forgot about it....)

This topic is closed to new replies.

Advertisement