implicitdeclaration of function 'delay.ms' is invalid in c99
时间: 2023-11-19 16:55:19 浏览: 167
这个问题的原因是在调用delay.ms函数之前没有进行声明。在C99标准下,如果函数在调用之前没有声明,编译器会产生implicit declaration of function 'XXXX' is invalid in C99警告。解决这个问题的方法是在调用delay.ms函数之前进行声明或者包含定义delay.ms函数的头文件。如果已经有过声明,需要去排查头文件的宏是否重复定义了。
相关问题
implicit declaration of function Key.h is invaild in C99
"implicit declaration of function Key.h is invalid in C99"是一种C语言编译器的警告信息,意思是在程序中调用了一个未声明的函数。在头文件中使用#ifndef语句可以避免头文件被重复引用,但是如果头文件中定义的函数没有被正确声明,就会出现这个警告信息。这个问题可以通过在头文件中正确声明函数来解决。
implicit declaration of function 'usleep' is invalid in C99
这个问题通常是因为代码中使用了usleep函数,但是没有正确地包含头文件。在C99标准中,usleep函数被认为是不安全的,应该使用nanosleep函数来替代。所以最好的解决方案是包含头文件<unistd.h>,并使用nanosleep函数代替usleep函数。如果你的代码必须使用usleep函数,你可以在代码中加入以下宏定义来解决这个问题:
```c
#define _BSD_SOURCE || _XOPEN_SOURCE >= 500
#include <unistd.h>
```
这个宏定义会告诉编译器使用usleep函数的定义。但是请注意,这种方法可能会导致你的代码在不同的操作系统上出现不兼容的问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![sub](https://img-home.csdnimg.cn/images/20210720083646.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)