在h文件定义的函数,参数带const,而在cpp文件中实现函数时,参数没有带const。则编译时所有调用该函数的地方会报undefined reference to错误。两者修改一致就好了。
如:
h文件定义的函数 void Test(const int A);
cpp文件定义的函数 void Test(int A);
qt undefined reference to的原因之一
最新推荐文章于 2024-05-10 17:17:31 发布
在h文件定义的函数,参数带const,而在cpp文件中实现函数时,参数没有带const。则编译时所有调用该函数的地方会报undefined reference to错误。两者修改一致就好了。
如:
h文件定义的函数 void Test(const int A);
cpp文件定义的函数 void Test(int A);