一、问题
使用Keil C51编译,总是提示编译错误
CUST_TASKS.C: ‘irDataPsn‘: undefined identifier
代码如下,irDataPsn明明定义了,还提示没定义,编译不过。
void vCUST_PSN_IrTask(IR_DATA_TYPE irData, IR_DATA_TYPE irData1) { UINT8 ret; IR_DATA_TYPE irDataPsn; LogSD("vCUST_PSN_IrTask ", _MGetIrType()); if(_MGetIrType()!=IRRX_PSN_TYPE) { LogD(irData); return; } IR_DATA_TYPE irDataPsn; irDataPsn = irData >> 24 + irData1 & 0x0000FFFF << 8;
二、解决
void vCUST_PSN_IrTask(IR_DATA_TYPE irData, IR_DATA_TYPE irData1) { UINT8 ret; IR_DATA_TYPE irDataPsn; LogSD("vCUST_PSN_IrTask ", _MGetIrType()); if(_MGetIrType()!=IRRX_PSN_TYPE) { LogD(irData); return; } // IR_DATA_TYPE irDataPsn; irDataPsn = irData >> 24 + irData1 & 0x0000FFFF << 8;
如上,要把定义写在最上面,编译通过。应该是C51编译器没那么强大,所以限制多。
原文地址:https://www.cnblogs.com/DaSunWarman/p/9136418.html
时间: 2024-11-06 07:37:05