问题
A.h file
class A{
public:
static int* func (int &b);
}
A.cpp
int* A::func(int &b){
//some definition here
}
I am calling the above function in some other file. I have included the .h file in that. When I try to compile I get the following error
undefined reference to A::func(int &)
回答1:
The code looks right.
The first thing to check is that your build environment compiled and linked in A.cpp.
来源:https://stackoverflow.com/questions/12399453/c-linker-error-undefined-reference-to-a-static-function