fatal error LNK1104/5: cannot open/close file

Monkey Targets Forums/Desktop/fatal error LNK1104/5: cannot open/close file

ErikT(Posted 2012) [#1]
I've just returned to Monkey after a month or so and out of the blue I get these when I'm compiling for glfw:


Generating code
Finished generating code
LINK : fatal error LNK1105: cannot close file 'D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\Release\MonkeyGame.exe' [D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.vcxproj]
Done Building Project "D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.sln" (default targets) -- FAILED.

Build FAILED.



And if the build folder contains a glfw build:


LINK : fatal error LNK1104: cannot open file 'D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\Release\MonkeyGame.exe' [D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.vcxproj]
Done Building Project "D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\MonkeyGame.sln" (default targets) -- FAILED.

Build FAILED.



I get a working build if there isn't one in the build folder already but it errors out every time. What the hell..? Is this some privilege crap fresh off a recent w7 update or something?


slenkar(Posted 2012) [#2]
did you delete your build folder :)

and are you sure there isnt a monkeygame.exe in your task manager?


ErikT(Posted 2012) [#3]
Check and check. I'll try and re-install vc 2010 and see what happens..


slenkar(Posted 2012) [#4]
try to delete monkeygame.exe yourself

the one located here:
D:\Work\G2\Monkey_0.22\main.build\glfw\vc2010\Release\MonkeyGame.exe


slenkar(Posted 2012) [#5]
I got a similar error just now, I re-compiled without deleting anything and it worked


ErikT(Posted 2012) [#6]
Actually I get a working build out of it if the build folder's empty. It's just that Monk, well the vc compiler I guess, throws a LNK1105 error and claims the build fails. If I try to compile and the build folder contains a glfw build already, I get a LNK1104 error and nothing gets replaced.

Wooh, just discovered that html5 and flash throw errors too: exception access violation. This is weird!

EDIT: Okay, seems Windows 7 insists on keeping the build folder set to read-only for some reason. That's probably what's causing it. I hate Windows.

EDIT 2: Or maybe not. Monkey v49 and earlier work without any problems whatsoever. No idea what's happening...


Kauffy(Posted 2012) [#7]
This issue was caused (for me) by the MonkeyGame.exe being held open by Windows Error Reporting (the previous run had crashed and even though the .exe was out of memory, WER still had a handle for the file). Even Process Explorer couldn't close the handle (so I couldn't delete or anything else) or shut down WER.

I found a program online called Unlocker that was able to delete the .exe so I could rebuild.