我有一个头:实现类的静态方法
class a
{
public:
a();
static int Zero();
void SimpleEx();
}
和CPP文件:
错误1个错误:
a() { } static int a::Zero() {return 0;} void SimpleEx() { cout << a::Zero(); }
编译时出现错误LNK2019:函数“public:class a __thiscall a :: SimpleEx(void)”中引用的未解析外部符号“public:static class a __cdecl a :: Zero(void)”(?Zero @ a @@ SA?AV1 @ XZ) (?SimpleEx @一@@ QAE? AV1 @ XZ)
如何解决这个问题?
尽量不要使用static关键字 – smac89 2014-10-16 22:07:56