Error 1 error LNK1104 after change Preprocess to a File

佐手、 提交于 2021-02-10 07:45:37

问题


I had to use a preprocessor, so I changed:

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

And got the error:

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

The solution to this problem:

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

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.


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/28494509/error-1-error-lnk1104-after-change-preprocess-to-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!