Error 1 error LNK1168: cannot open for writing

I was writing a simple C program to print “HelloWorld” while using the new improved Visual Studio 2010. Program compiled fine on the first run but I started to get a weird linking error (see title of post) on recompiling later on.

I singled out the problem to a service in Windows 7. Earlier in the week, I disabled a bunch of (unnecessary) Windows service processes to speed up my OS and happened to disable “Application Experience” service as well.

Enabling the service has solved the issue completely. The reason is because Application Experience service is used to process application compatibility cache requests for applications as they are launched.

18 Responses to Error 1 error LNK1168: cannot open for writing

  1.  

    you sir , are a lifesaver !!

  2.  

    Awesome man, i’ve posted this problem to Microsoft but didn’t got any answer, and now just AWESOME.

  3.  

    that fixed it… had that problem both with c# and c

  4.  
  5.  

    Sir,
    Im using windows xp professional sp2 and getting the same error.
    But i did’nt find the service “Application Experience” in services.msc in my system.. So could you please help me solve this…

  6.  

    Thanks so mutch, solve my problem perfectly.

  7.  

    This used to work for me but now it has stopped working!! ARGH!!! How can Microsoft allow something like this to be open for 3 YEARS?!

  8.  

    Thanks a lot sir… I was stuck in this problem for year now… You saved tons of my effort.

  9.  

    Thanks so much! I’ve been suffering this problem for months!!!

  10.  

    I’m not getting the LNK1168 error, but I am having issues with something (maybe a windows service?) locking the output files (thereby preventing further builds. It might be McAfee, I know that software is completely insane about executables.. especially when they show in Windows explorer (when you browse to a folder that houses an exe). Not sure yet.

  11.  

    Thanks for posting this !

  12.  

    Thank you! This solution resolved an issue with a client that was randomly unable to rename files/folders.

  13.  

    Uh, In my case (Win 8.1) disabling the service solved the issue… weird!

  14.  

    It did no solve the problem for me.

  15.  

    how do i do that descibe the steps please

  16.  

    Wow. Thank you. I spent 3 days trying to figure out the cause of this problem. I was almost sure it was an Explorer extension or a mini file filter as I noticed sometimes unlreated folders were not deletable for no reason and when viewing a folder in explorer.. I spent countless hours watching dependancies of different processes and monitoring handle counts…. I enabled the Application Experience service and I was able to build in MSVS back-to-back now…

  17.  

    I know this is an old thread…but you have saved me two weeks of tearing my hair out – two windows reinstalls and software reinstalls…all because I disabled Application Experience to cut out unneccesary services! Thank you man and may much good karma come your way.

  18.  

    I think it solved my error renaming and moving files -> file is in use by an other process. I had to wait for about a minute and then it worked. It annoyed me for a looooooong time. For now, it works immediately, no more error.
    I wonder how this bug can still be uncorrected after 6 years, unless Microsoft wants to prevent us from stopping the spying service.
    Thank you so much!!!

leave your comment