0
votes

I'm working with VS 2013, using UI forms. In MyForm.h there is a code

class A
{
public:
    A();
    ~A();
private:
};

void b()
{
    A var;
}

I get those errors:

Error   2   error LNK2028: unresolved token (0A00000A) "public: __thiscall A::A(void)" (??0A@@$$FQAE@XZ) referenced in function "void __cdecl b(void)"
Error   3   error LNK2028: unresolved token (0A00000B) "public: __thiscall A::~A(void)" (??1A@@$$FQAE@XZ) referenced in function "void __cdecl b(void)"
Error   4   error LNK2019: unresolved external symbol "public: __thiscall A::A(void)" (??0A@@$$FQAE@XZ) referenced in function "void __cdecl b(void)"
Error   5   error LNK2019: unresolved external symbol "public: __thiscall A::~A(void)" (??1A@@$$FQAE@XZ) referenced in function "void __cdecl b(void)"

I've already googled for about two hours, but, still no result.

1
You neither defined the constructor nor destructor. If you want the default definitions, write = default after both declarations (before the semicolon).Columbo
Gracias. Fell myself stupid.Entrack

1 Answers

0
votes

You have to define the constructor and destructor like:

class A{
public:
    A();
    ~A();
private:
};
  A::A(){
}
  A::~A(){
}
void b()
{
  A var;
}