Sunday 28 August 2016

c++ - error LNK2019: unresolved external symbol "public: __thiscall Signal

When I call main() function I get error:




Error 2 error LNK2019: unresolved external symbol "public: __thiscall Signal::Signal(void)" (??0?$Signal@H@@QAE@XZ) referenced in function "public: __thiscall Img::Img(int,int)" (??0?$Img@H@@QAE@HH@Z) c:\Users\Maja\documents\visual studio 2012\Projects\Project6\Project6\Img.obj Project



Can anyone tell me how to set Linker to not call default constructor and to call one that I want?



template  class Signal {

protected: int N; // width of array
int M;
private: double deltaT; // sampling period

double t0; // initial time
int flag; // indicator
public:
T* sig; // array of type T
T** sig2D;
Signal(void); // constructor
Signal (int); // constructor
Signal (int,int);
Signal (int,double); // constructor
Signal(int,int,double);

Signal (int,double,double); // constructor
Signal(int,int,double,double);
};


template class Img:public Signal
{
public:
Img(void);
~Img(void);

Img(int,int);
};


template Img::Img(int a,int b){
Signal(a,b); // or Signal::Signal(a,b);
}

int main() {


Img *a=new Img(2,3);
}

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...