简体   繁体   English

Visual Studio C++ 中的错误代码 = 0x80070002

[英]Error code = 0x80070002 in visual studio c++

I just installed visual studio, (not new to coding) and I keep getting an error that goes like "error: unable to open file C:user...main.obj Error code = 0x80070002" an Image of the error this error shows up whenever there is something wrong with my code like for example if i do:我刚刚安装了visual studio,(不是编码新手),我不断收到类似“错误:无法打开文件 C:user...main.obj 错误代码 = 0x80070002”的错误,此错误显示的错误图像每当我的代码出现问题时,例如,如果我这样做:

#include <iostream>

int main()
{
std::cout << "Hello World!\n";
}

everything runs normal, but if I make a mistake say:一切正常,但如果我犯了错误,请说:

#include <iostream>

int main()
{
std::cout std::cout << "Hello World!\n";
}

I get the error, it's so annoying I don't want to get that error every time there is something wrong with my code the error list bar is enough, what do I do ?我收到错误,这太烦人了,我不想每次我的代码有问题时都​​收到该错误,错误列表栏就足够了,我该怎么办?

Could you please tell us what version of Visual Studio are you using?您能告诉我们您使用的是哪个版本的 Visual Studio 吗?

If you are using vs2017 or later, I suggest you could try to use /DEBUG:FULL property in "Linker/Debugging/Generate Debug Info.如果您使用的是 vs2017 或更高版本,我建议您可以尝试在“链接器/调试/生成调试信息”中使用/DEBUG:FULL属性。

在此处输入图片说明

I suggest you could refer to the Doc :我建议你可以参考文档

When you specify /DEBUG with no additional options, the linker defaults to /DEBUG:FULL for command line and make file builds, for release builds in the Visual Studio IDE, and for both debug and release builds in Visual Studio 2015 and earlier versions.当您指定 /DEBUG 而不使用其他选项时,链接器默认为/DEBUG:FULL用于命令行和生成文件构建、Visual Studio IDE 中的发布构建以及 Visual Studio 2015 和更早版本中的调试和发布构建。 Beginning in Visual Studio 2017, the build system in the IDE defaults to /DEBUG:FASTLINK when you specify the /DEBUG option for debug builds.从 Visual Studio 2017 开始,当您为调试生成指定 /DEBUG 选项时,IDE 中的生成系统默认为/DEBUG:FASTLINK Other defaults are unchanged to maintain backward compatibility.其他默认值不变以保持向后兼容性。

在不同的磁盘中重建程序或重新安装 VS 可能是我认为的最终解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM