这是我的功能声明。我使用Visual Studio 2010 C ++得到了一个未解决的外部错误。
bool CheckCrcByte(const CHAR_t* pbData, UINT32_t lLength, UINT32_t lMsgCrc)
{
bool FlagPass;
UINT32_t lCalcCrc;
UINT32_t lInitCrc = 0;
lCalcCrc = ~lInitCrc;
CHAR_t* bCurrent = (CHAR_t*) pbData;
while (lLength-- > 0)
{
lCalcCrc = (lCalcCrc >> 8) ^ crc_TABEL[(lCalcCrc & 0xFF) ^ *bCurrent++];
}
lCalcCrc = ~lCalcCrc;
if (lMsgCrc == lCalcCrc)
{
FlagPass = true;
}
else
{
FlagPass = false;
}
return FlagPass;
}
答案 0 :(得分:0)
这意味着您已声明了该函数:
bool CheckCrcByte(char const *,unsigned int,unsigned int);
但你没有定义它。要定义它,请在.cpp
文件中执行以下操作:
bool CheckCrcByte(char const * c,unsigned int i1,unsigned int i2)
{
//Your function code goes here.
}
始终确保声明的函数原型与其标识符和参数类型的定义相匹配。
在以下代码中:
bool CheckCrcByte(const CHAR_t* pbData, UINT32_t lLength, UINT32_t lMsgCrc)
{
//YOUR TYPES ARE NOT THE SAME THEREFORE IT IS A DIFFERENT FUNCTION DEFINITION
}
根据您在评论中定义的内容,您已定义了第二个函数,但您还需要定义第一个函数。它们是两个不同的功能。