为什么会出现致命错误“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.
在配置属性->链接器 ->项目属性的输入选项卡,有一个Additional Dependencies属性.此问题已通过添加引号解决.例如,将此属性更改为:
On the Configuration Properties -> Linker -> Input tab of the project’s properties, there is an Additional Dependencies property. This issue was fixed by adding the quotes. For example, changing this property from:
C:Program Files软件sdkliblibrary.lib
C:Program Filessofware sdkliblibrary.lib
致:
"C:Program Filessofwaresdkliblibrary.lib"
"C:Program Filessofware sdkliblibrary.lib"
我加引号的地方.
这篇关于为什么会出现致命错误“LNK1104:无法打开文件 'C:Program.obj'"?在 Visual Studio 中编译 C++ 项目时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!