在编译sd卡程序是出现以下错误,错误程序如下,求各位大侠帮助解决以下,谢谢啦 //发命令到SD卡 void SdCommand(u8 command, u32 argument, u8 CRC) { SdWrite(command|0x40); SdWrite(((unsigned char *)&argument)[0]); SdWrite(((unsigned char *)&argument)[1]); SdWrite(((unsigned char *)&argument)[2]); SdWrite(((unsigned char *)&argument)[3]); SdWrite(CRC); } User\SD.c(64): error: #79: expected a type specifier User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC) User\SD.c: ^ User\SD.c(64): error: #90: function returning function is not allowed User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC) User\SD.c: ^ User\SD.c(64): error: #141-D: unnamed prototyped parameters not allowed when body is present User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC) User\SD.c: ^ User\SD.c(72): error: #167: argument of type "CRC_TypeDef *" is incompatible with parameter of type "unsigned char" User\SD.c: SdWrite(CRC); User\SD.c: ^ User\SD.c(88): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)" User\SD.c: SdCommand(0x00,0,0x95); User\SD.c: ^ User\SD.c(103): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)" User\SD.c: SdCommand(0x01,0x00ffc000,0xff); User\SD.c: ^ User\SD.c(78): warning: #177-D: variable "delay" was declared but never referenced User\SD.c: int delay=0, trials=0; User\SD.c: ^ User\SD.c(78): warning: #177-D: variable "trials" was declared but never referenced User\SD.c: int delay=0, trials=0; User\SD.c: ^ User\SD.c(122): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)" User\SD.c: SdCommand(0x18,address,0xff); User\SD.c: ^ User\SD.c(170): error: #167: argument of type "int" is incompatible with parameter of type " (*)(CRC_TypeDef *)" User\SD.c: SdCommand(0x11,address,0xff); |
RE:sd卡编译过程出错,求指导
RE:sd卡编译过程出错,求指导
2)"int" is incompatible with parameter of type " (*)(CRC_TypeDef *)",这个问题肯定是一个头文件没有包含,所以CRC_TypeDef *没有定义
3)90: function returning function is not allowed
User\SD.c: void SdCommand(u8 command, uc32 argument, u8 CRC)这个应该是函数中的return 有语法错误,函数申明为void类型的返回值
RE:sd卡编译过程出错,求指导
这个错误是处在 SdWrite(((unsigned char *)&argument)[0]);这个函数中,好好检查一下就能找到。
RE:sd卡编译过程出错,求指导
等参数类型不相匹配,可以尝试强制转换或修改其中的数据类型以求一致
RE:sd卡编译过程出错,求指导
给你吧,参考一下,多想一点,有收获!