简体   繁体   中英

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:

#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?

If you are using vs2017 or later, I suggest you could try to use /DEBUG:FULL property in "Linker/Debugging/Generate Debug Info.

在此处输入图片说明

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. Beginning in Visual Studio 2017, the build system in the IDE defaults to /DEBUG:FASTLINK when you specify the /DEBUG option for debug builds. Other defaults are unchanged to maintain backward compatibility.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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