0
votes

i have tried to create array of object in c++ but i get somekind of weird error, and i don't know why.

    Complex ** tab; //class field

matrix::matrix(int x, int y) //construktor
{
    tab = new Complex * [x];
    for (int i = 0; i < x; i ++)
    {
        tab[i] = new Complex[y];
    }

The errors are :

1>matrix.obj : error LNK2019: unresolved external symbol "public: __thiscall Complex::Complex(void)" (??0Complex@@QAE@XZ) referenced in function "public: __thiscall matrix::matrix(int,int)" (??0matrix@@QAE@HH@Z)

1>matrix.obj : error LNK2019: unresolved external symbol "public: __thiscall Complex::~Complex(void)" (??1Complex@@QAE@XZ) referenced in function "public: __thiscall matrix::matrix(int,int)" (??0matrix@@QAE@HH@Z)

What is wrong?

1
Some kind of weird comment.Alan Stokes

1 Answers

0
votes

As your program is compiling and failed to link for the default constructor and the default destructor, it is evident that you are missing the implementation

Complex::Complex()
Complex::~Complex()

Provide the implementations and it should resolve your issue. Are they supposed to be trivial and you have missed to include double open close brace?

Complex {
    ......
    Complex(){}
    ~Complex() {}
    ........

}