Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

This particular issue is caused by specifying a dependency to a lib file that had spaces in its path. The path needs to be surrounded by quotes for the project to compile correctly.

On the Configuration Properties -> Linker -> Input tab of the project’s properties, there is an Additional Dependencies property. This issue was fixed by changing this property from:

C:\Program Files\sofware sdk\lib\library.lib

To:

" C:\Program Files\sofware sdk\lib\library.lib"

Where I added the quotes.


This can happen if the file is still running as well.

:-1: error: LNK1104: cannot open file 'debug\****.exe'


The problem went away for me after closing and re-opening Visual Studio. Not sure why the problem happened, but that might be worth a shot.

This was on VS 2013 Ultimate, Windows 8.1.