你好我有其中包括内联函数,当我尝试用谷歌测试测试这个类时,我有如下错误:
error LNK2019: unresolved external symbol "public: double __thiscall Math::returnPi(void)" (?returnPi@Math@@QAENXZ) referenced in function "private: virtual void __thiscall Speed_Math_Test::TestBody(void)" (?TestBody@Speed_Math_Test@@EAEXXZ)
例如我的类(头文件)
class Math
{
public:
Math(void);
inline double returnPi();
~Math(void);
};
我的课(cpp文件)
Math::Math(void)
{}
Math::~Math(void)
{}
double Math::returnPi()
{ return 3.14;}
测试:
TEST(EQ, Math)
{
Math *m=new Math();
EXPECT_EQ(3.14,m->returnPi());
}
我需要做什么?我阅读了手册,但看不到如何解决此错误。