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

linker, visual-c++

Solution

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 can be fixed by adding the quotes. For example, 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.

Problem

I've created a new C++ project in Visual Studio 2008. No code has been written yet; Only project settings have been changed. When I compile the project, I receive the following fatal error: fatal error LNK1104: cannot open file 'C:\Program.obj'

Original source

Related problems