implicit declaration of function ‘put_str’ [-Wimplicit-function-declaration] put_str("I am kernel\n");
时间: 2023-11-19 19:38:08 浏览: 60
这个错误是因为编译器在编译的时候找不到 `put_str` 函数的声明,因此默认函数的返回类型为 `int`,这会导致编译错误。
要解决这个问题,你需要在代码中添加 `put_str` 函数的声明或者包含 `put_str` 函数所在的头文件。例如,如果 `put_str` 函数在 `string.h` 头文件中,你可以添加 `#include <string.h>` 到文件的开头。如果 `put_str` 函数是自定义函数,你需要在代码中添加函数的声明,例如 `void put_str(char *str);`。这个声明可以放在文件的开头或者函数调用之前。
相关问题
implicit declaration of function '' [-Wimplicit-function-declaration]
在编程中,当你使用一个函数而没有提前声明或定义它时,编译器会发出警告,提示你存在隐式函数声明。这个警告的具体内容是"implicit declaration of function '' [-Wimplicit-function-declaration]",其中''表示函数名。
隐式函数声明是指在使用函数之前没有提前声明或定义该函数。编译器会默认假设该函数的返回类型为int,并且可以接受任意数量和类型的参数。然而,这种假设可能会导致编译错误或运行时错误。
为了解决这个问题,你需要在使用函数之前提前声明或定义该函数。声明函数的方式是在使用函数之前写上函数的原型,包括函数名、返回类型和参数列表。如果函数已经在其他地方定义过,你只需要提前声明即可;如果函数还没有定义,你需要在声明之后再进行定义。
implicit declaration of function 'LED_STA' [-Wimplicit-function-declaration
回答: 根据提供的引用内容,问题中的错误信息是"implicit declaration of function 'LED_STA' \[-Wimplicit-function-declaration\]"。根据这个错误信息,可以判断在代码中使用了一个未声明的函数"LED_STA"。然而,根据提供的引用内容,没有找到与"LED_STA"相关的代码或函数声明。因此,可能需要检查代码中是否存在拼写错误或者确保函数"LED_STA"已经正确声明和定义。
#### 引用[.reference_title]
- *1* [warning: implicit declaration of function ‘inet_ntop’解决办法](https://blog.csdn.net/David_xtd/article/details/7946913)[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]
- *2* *3* [STM32F105RBT6 uart调试](https://blog.csdn.net/smile_5me/article/details/105708072)[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)