Error code = 0x80070002 in visual studio c++

0

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 ?

c++
visual-studio
asked on Stack Overflow Mar 26, 2020 by VoId Production

2 Answers

0

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.

enter image description here

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.

answered on Stack Overflow Mar 27, 2020 by Jeaninez - MSFT
0

Rebuild the program in a different disk or reinstall the VS could be the final solution I think.

answered on Stack Overflow Mar 27, 2020 by Chris

User contributions licensed under CC BY-SA 3.0