(.text+0x8b): undefined reference to `TwoD::TwoD()'
P.cpp:(.text+0x122): undefined reference to `TwoD::TwoD(int, int)'
P.cpp:(.text+0x12d): undefined reference to `TwoD::~TwoD()'
P.cpp:(.text+0x149): undefined reference to `TwoD::~TwoD()'
P.cpp:(.text+0x15f): undefined reference to `TwoD::~TwoD()'
collect2: ld returned 1 exit status
in the main function
int main()
{
TwoD Twda; // Declaring the three TwoD objects containing
int r, c;
cout << "How many rows will be in your arrays?" << endl;
cin >> r;
cout << endl << "How many columns will be in your arrays?" << endl;
cin >> c;
This isn't correct. What you meant to say was Twda(r, c); // Creating the arrays which is the object of class TwoD passing the r and c variables as arguments. Also make sure your including your header files correctly in both your main and class implementation files.
Hi
I still have the errors!!!!!???? I do no know becouse I did the sugestions I post the constructor
P.cpp:(.text+0x9b): undefined reference to `TwoD<float>::TwoD(int, int)'
P.cpp:(.text+0xb6): undefined reference to `TwoD<float>::print(int, int)'
P.cpp:(.text+0xd2): undefined reference to `TwoD<float>::~TwoD()'
P.cpp:(.text+0xe8): undefined reference to `TwoD<float>::~TwoD()'
collect2: ld returned 1 exit status
--------------------------------------------------------------------
the constructor is
TwoD<T>::TwoD( int x, int y)
{
r = x;
c = y;
elet = new int *[r];
for (int i = 0; i < r; i++){
elet[i] = new int [c];
}
for (int i=0; i < r; i++){
for(int j=0; j < c; j++){
elet[i][j] = i*j;
}
}
}
--------------------------------------------------------
the min is