为什么出现致命错误"LNK1104:无法打开文件'C:\ Program.obj'"?在Visual Studio中编译C ++项目时会发生什么? [英] Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?
问题描述
我已经在Visual Studio 2008中创建了一个新的C ++项目.仅项目设置已更改.
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:
严重错误LNK1104:无法打开文件'C:\ Program.obj'
fatal error LNK1104: cannot open file 'C:\Program.obj'
推荐答案
此特定问题是由于指定对路径中带有空格的lib文件的依赖关系引起的.为了正确编译项目,路径必须用引号引起来.
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
C:\Program Files\sofware sdk\lib\library.lib
收件人:
"C:\ Program Files \ sofware sdk \ lib \ library.lib"
" C:\Program Files\sofware sdk\lib\library.lib"
我在其中添加引号的地方.
Where I added the quotes.
这篇关于为什么出现致命错误"LNK1104:无法打开文件'C:\ Program.obj'"?在Visual Studio中编译C ++项目时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!