0

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?

Shayan Ghosh
  • 882
  • 6
  • 14
  • 1
    [See this question](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix), perhaps [this answer](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574407#12574407) or [this one](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574400#12574400). – chris Apr 18 '15 at 18:15
  • Some kind of weird comment. – Alan Stokes Apr 18 '15 at 18:51

1 Answers1

0

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() {}
    ........

}
Abhijit
  • 62,056
  • 18
  • 131
  • 204
  • I rewrite it again and start working ;d thx. May i have one more question? This is my first time on stackoverflow. Could you tell me why when i ask about something after few second i get a lot of "-" and report? Am i doing something wrong? – Hangoverflow Apr 18 '15 at 18:32