问题
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