error C2556: 'void __thiscall ::sendCommand1(unsigned int,const char *,int)' : overloaded function differs only by return type from 'int __thiscall
error C2371: 'sendFtCommand1' : redefinition; different basic types
这个错误是这样产生的:
在 .cpp文件中 为
void A::B()
而在.h 文件中声明时没有 写返回类型,而只写了B()
不细心产生的错误。
本文解析了C++编译时出现的两个常见错误:函数重定义和仅因返回类型不同导致的重载冲突。通过具体示例展示了如何避免这类错误,强调了在声明和实现函数时保持一致的重要性。

被折叠的 条评论
为什么被折叠?



