C 函数原型中的预期")"

expected ')' in c function prototype

本文关键字:函数 原型      更新时间:2023-10-16

我有一个在头文件和源文件之间划分的函数,如下所示,

在头文件中:

uint8_t SoundEffects(uint8_t EffectType,uint8_t RecordedSample); 

在源文件中:

uint8_t SoundEffects(uint8_t EffectType,uint8_t RecordedSample)
{
    // some code
} 

生成以下错误

SoundEffects.h:7:错误:在"EffectType"之前应为"(">
SoundEffects.c:3:错误:在"EffectType"之前应为"(">

我已经尝试了所有的方法,删除了变量名,将uint8_t更改为unsigned char,但都不起作用。问题出在哪里?

确保您还没有将令牌#defineSoundEffects绑定到其他对象。

当'EffectType'之前的令牌未被识别为类型时,我会出现此错误。在这种情况下,为'uint8_t'。我的猜测是,您需要在头文件的顶部'include <stdint.h>'(或者至少在包含头文件之前(。