在h文件定义的函数,参数带const,而在cpp文件中实现函数时,参数没有带const。则编译时所有调用该函数的地方会报undefined reference to错误。两者修改一致就好了。 如: h文件定义的函数 void Test(const int A); cpp文件定义的函数 void Test(int A);