gpt4 book ai didi

c++ - 更改 Preprocess to a File 后出现错误 1 ​​error LNK1104

转载 作者:太空宇宙 更新时间:2023-11-04 13:39:01 26 4
gpt4 key购买 nike

我不得不使用预处理器,所以我改变了:

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

得到错误:

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

这个问题的解决方法:

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

我不明白.lib是什么文件?它在哪里?在我的项目中,它不是。我需要在Additional Dependencies 中指定什么?我试图在引号中添加调试我的项目的路径,但没有任何反应。

最佳答案

编译器输出 .obj 文件或预处理文件。当您启用预处理器输出时,您实际上禁用了 .obj 文件的输出。

VS 不考虑这一点并启动链接器。由于您没有输出 .obj 文件,因此链接器无法找到它。

当您有一个旧的 .obj 文件并且源代码中的更改生成新的预处理输出但不进入链接的可执行文件时,您可能会遇到更多麻烦。

关于c++ - 更改 Preprocess to a File 后出现错误 1 ​​error LNK1104,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28494509/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com