Jump to content
  • Advertisement
phil67rpg

Error LNK1168

Recommended Posts

I get the following error using vs2017

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK1168    cannot open c:\users\owner\documents\visual studio 2017\Projects\Debug\Win32Project1.exe for writing    Win32Project1    c:\Users\Owner\documents\visual studio 2017\Projects\Win32Project1\LINK    1    
 

Share this post


Link to post
Share on other sites
Advertisement
37 minutes ago, phil67rpg said:

cannot open filename.exe for writing 

(I deleted the path and changed the filename for simpler reading.) Looks like you're trying to edit an EXE file. 

Share this post


Link to post
Share on other sites
20 minutes ago, Tom Sloper said:

Looks like you're trying to edit an EXE file. 

how do I fix this problem?

Share this post


Link to post
Share on other sites
Posted (edited)
6 minutes ago, phil67rpg said:

how do I fix this problem?

Most likely you didn't close the last run of your program and the compiler can't write the new version out. Check your taskbar. Maybe check task manager also.

Edited by fleabay

Share this post


Link to post
Share on other sites
5 hours ago, phil67rpg said:

I get the following error using vs2017

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK1168    cannot open c:\users\owner\documents\visual studio 2017\Projects\Debug\Win32Project1.exe for writing    Win32Project1    c:\Users\Owner\documents\visual studio 2017\Projects\Win32Project1\LINK    1    
 

Usually this means you have your program running at the same time you are tying to compile it.  The system knows the .exe file is in use so it's telling you you have to close the program before doing the compile so it can write a new version of the exe.  Also I've seen it before that even if your program is no longer running, the system gets confused and thinks the exe is still in use.  If all else fails, reboot your system.

Share this post


Link to post
Share on other sites
Posted (edited)

Funnily, Linux lets you change an executable that is currently running (at least on ext-filesystems). The change doesn't affect the file in memory, just next time it is started the new version will be loaded.

The "problem" might be file system/os dependent, or a built-in functionality in visual studio. Is there a logical reason not to change executables on disk that are currently running ? Updates for example depend on that ...

Edited by Green_Baron

Share this post


Link to post
Share on other sites
3 minutes ago, Green_Baron said:

Funnily, Linux lets you change an executable that is currently running (at least on ext-filesystems). The change doesn't affect the file in memory, just next time it is started the new version will be loaded.

The "problem" might be file system/os dependent, or a built-in functionality in visual studio. Is there a logical reason not to change executables on disk that are currently running ? Updates for example depend on that ...

I vaguely remember that the exe is, or at least was used to swap in code and/or constant data when memory was tight. Don't quote me on this however.

Share this post


Link to post
Share on other sites

Yeah ... there was something like that ...

Or another process (anti-virus thing ?) has its thumb on it ?

 

Anyway:

https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1168?view=vs-2019

 

 

I frequently discover one or two windows from earlier debug runs that were hiding behind the ide window when i close it ... :-)

 

Share this post


Link to post
Share on other sites
2 minutes ago, Green_Baron said:

I frequently discover one or two windows from earlier debug runs that were hiding behind the ide window when i close it ... 🙂

 

Ha, ha, Same here 😄

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!