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

0

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;
}
c++
asked on Stack Overflow Nov 8, 2018 by dabal_69

1 Answer

1

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).

answered on Stack Overflow Nov 9, 2018 by LuisGP

User contributions licensed under CC BY-SA 3.0