implicit declaration of function ‘gpio_resetbits’ is invaild in c99具体怎么修改
时间: 2023-11-19 13:22:01 浏览: 46
这个错误通常是因为在 C99 标准下缺少头文件导致的。在 C99 标准中,需要显式声明函数,如果函数没有在代码中进行显式的声明,编译器就会报出 implicit declaration of function ‘gpio_resetbits’ is invalid in c99 的错误。
为了解决这个错误,需要在代码中引用适当的头文件,并显式地声明函数。头文件通常包含函数声明和其他必要的宏定义和变量声明。在这种情况下,你需要找到 gpio_resetbits 函数所在的头文件,然后在代码的开头使用 #include 指令引用该头文件。同时,你需要在代码中显式地声明该函数,可以使用 extern 关键字实现。例如:
#include <gpio.h> // 假设这是gpio_resetbits函数所在的头文件
extern void gpio_resetbits(int pin); // 在代码中显式声明gpio_resetbits函数
这样,在编译代码时,编译器就能够正确地识别 gpio_resetbits 函数,避免了 implicit declaration of function ‘gpio_resetbits’ is invalid in c99 的错误。
相关问题
implicit declaration of function ‘gpio_resetbits’ is invaild in c99
这个问题表明,您的代码中试图调用一个未声明的函数 gpio_resetbits。在 C99 标准中,要求在使用函数之前必须先声明函数。最好的解决方案是在代码中添加一个函数声明,以便编译器知道该函数的存在,并且可以正确地编译您的代码。如果函数确实未定义,请确保在引用它之前添加函数定义。另外,请确保您的编译器设置正确,以便使用 C99 标准进行编译。
Warning: implicit declaration of function 'fmc_erase' is invalid in C99
引用\[1\]:告警类型:warning: implicit declaration of function 'gets' is invalid in C99 \[-Wimplicit-function-declaration\]。引用\[2\]:函数“gets”的隐式声明在C99中无效。引用\[3\]:如果只声明函数而没有定义函数(函数的具体实现部分),那么就会直接报错:Error: L6218E: Undefined symbol function“XXX” (referred from main.o)!如果没有声明,但是已经定义了函数,只是会出现警告:Warning: #223-D: function “XXX” declared implicitly!。
问题:Warning: implicit declaration of function 'fmc_erase' is invalid in C99
回答: 这个警告是在C99标准中隐式声明函数'fmc_erase'无效导致的。在C99标准中,如果只声明函数而没有定义函数,会直接报错。如果没有声明但已经定义了函数,只会出现警告。所以,为了避免这个警告,你需要在代码中显式地声明函数'fmc_erase'。
#### 引用[.reference_title]
- *1* *2* [warning: implicit declaration of function ‘gets‘ is invalid in C99 [-Wimplicit-function-...](https://blog.csdn.net/qq_50635297/article/details/128265518)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [关于Warning:Implicit declaration of function “xxx” is invalid in C99警告!](https://blog.csdn.net/family20102010/article/details/126155338)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)