Hi in my program I have two constructors;
BinaryImage();
BinaryImage(int MM, int NN, double* input_data, double thresh);
In my main;
BinaryImage BinaryImageObj();
This compiles fine but when I invoke the second construtor;
BinaryImage BinaryImageObj2(MM,NN,data,1);
This however brings an error;
main.cpp||undefined reference to `BinaryImage::BinaryImage(int, int, double*, double)'
Why does it do this?, am I missing something simple?
Thanks
Mike
This matrix class constructor creates object
Matrix::Matrix(int MM, int NN, double* input_data){
M = MM;
N = NN;
data = new double[M * N];
for ( int i =0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
data[i* N+j] = input_data[i*N+j];
// cout << data[i*N+j] <<"\t";
}
// cout <<"\n";
}
cout << "This is the Matrix Constructor being invoked" << endl ;
}
binaryimage class (inherts from matrix)
BinaryImage::BinaryImage(int MM, int NN, double* input_data, double thresh ):Matrix(MM, NN, input_data)
{
M = MM;
N = NN;
data = new double[M * N];
for ( int i =0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
treshData(tresh);
}
}
}
Main
Matrix MatrixObj1(MM,NN,data2);
BinaryImage BinaryImageObj;
edited to show whats going on.