将预处理更改为文件后的错误1错误LNK1104 [英] Error 1 error LNK1104 after change Preprocess to a File

查看:55
本文介绍了将预处理更改为文件后的错误1错误LNK1104的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用预处理器,所以我进行了更改:

I had to use a preprocessor, so I changed:

配置属性-> C ++->预处理程序->对a
进行预处理文件->是

Configuration Properties -> C++ -> Preprocessor -> Preprocess to a
File -> Yes

并得到错误:

错误1错误LNK1104:无法打开文件"Debug \ asnreal.obj"

Error 1 error LNK1104: cannot open file 'Debug\asnreal.obj'

此问题的解决方案:

我必须在
中的.lib文件的路径周围添加引号.项目->属性->配置属性->链接器->输入->其他依赖项.

I had to add quotes around the path to my .lib file in
Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies .

我不知道哪种文件.lib?它在哪里?在我的项目中,事实并非如此.我需要在其他依赖项中指定什么?我试图用引号添加调试项目的路径,但是没有任何反应.

I do not understand what kind of file .lib? Where is it? In my project, it is not. What do I need to specify in Additional Dependencies? I tried to add the path to debug my project in quotation marks, but nothing happens.

推荐答案

编译器将输出 .obj 文件或经过预处理的文件.启用预处理程序输出时,实际上将禁用 .obj 文件的输出.

The compiler outputs either the .obj file or the preprocessed file. When you enable the preprocessor output you effectively disable the output of the .obj file.

VS不会考虑这一点,因此无论如何都会启动链接器.由于您没有输出 .obj 文件,因此链接程序无法找到它.

The VS doesn't take this in account and starts the linker anyway. Since you didn't output an .obj file the linker can't find it.

如果放置了旧的 .obj 文件,并且源代码中的更改生成了新的预处理输出但没有进入链接的可执行文件,则可能会遇到更多麻烦.

You can get much more in trouble when you have an old .obj file in place and changes in the source code generates new preprocessed output but don't get into the linked executable.

这篇关于将预处理更改为文件后的错误1错误LNK1104的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆