简体   繁体   中英

Error code = 0x80070002 (MS Visual Studio) C++

Well, I wrote a simple code to check the possibility of creating objects using 'new' operator. When I was trying to compile the code, the MS Visual Studio threw the error like this: " Error: Unable to open file C:\\Users...\\test1\\Debug\\main.obj. Error code = 0x80070002.Error: Could not find 'C:\\Users...\\test1\\Debug\\main.obj'. test1.exe was built with /DEBUG:FASTLINK which requires object files for debugging.

What is going on? Please help.

Code:

#include <iostream>

class czlowiek {
int wiek;
char plec;
czlowiek();
czlowiek(int Wiek, int Plec);
};

czlowiek::czlowiek(int Wiek, int Plec) {
    wiek = Wiek;
    plec = Plec;
}

int main()
{
czlowiek *first;
first = new czlowiek();
delete first;
std::cin.get();
return 0;
}

The code you posted will not link:

  • The constructor czlowiek() doesn't have an implementation.
  • Both constructors are private (in classes members and methods are private by default).

As warning, you are assigning a int to a char (plec).

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