使用c99编译出警告信息:implicit declaration of function ‘usleep’

按常规来讲,出现 “implicit declaration of function ‘xxxx’ ” 是因为头文件未包含导致的!

但是usleep的头文件unistd.h已经包含,让人很困惑!后来终于找到原因如下

原因:

原来是由于自己在编译时,为了可以for(int i; ...) 在Makefile中增加-std=c99导致的;

解决:

将-std=c99改为-std=gnu99

C99是直C99,GNU99是带有gnu扩展的C99。

clang支持-std选项,该选项更改clang使用的语言模式。 C支持的模式为c89,gnu89,c94,c99,gnu99以及这些模式的各种别名。 如果未指定-std选项,则clang默认为gnu99模式。

-std= 选择C语言编译标准

-std=
A value for this option must be provided; possible values are
`c99' `c9x' `iso9899:1999' `iso9899:199x'
ISO C99. Note that this standard is not yet fully supported; see http://gcc.gnu.org/c99status.htmlfor more information. The names `c9x' and `iso9899:199x' are deprecated.

`gnu99' `gnu9x'
GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC, this will become the default. The name `gnu9x' is deprecated.

c99编译报错改用gnu99相关推荐

  1. C编译报错: implicit declaration of function xxx is invalid in C99 [-Wimplicit-function-declaration]

    C编译报错: implicit declaration of function xxx is invalid in C99 [-Wimplicit-function-declaration] 代码文件 ...

  2. 【c语言 gcc9.1.0环境下编译报错】error: ‘true’ undeclared (first use in this function)

    问题 网上验证一个单链表是否有环的c语言demo,放到gcc9.1.0的环境下编译,发现编译报错: error: 'true' undeclared (first use in this functi ...

  3. go build 编译报错 missing go.sum entry for module providing package

    go build 编译报错 missing go.sum entry for module providing package 解决方法 // 移除未使用的依赖 go mod tidy 再次编译,就可 ...

  4. 编译报错field has incomplete type

    linux下编译C++代码报错,报错信息"field has incomplete type".这种问题一般都是在头文件对类或者结构体进行了前向声明,后面使用了该类定义了对象,导致 ...

  5. Eclipse中更改JDK版本,解决ant编译报错的问题

    要改一个JDK版本 主要是为了解决ant编译报错,JDK版本不一致的问题. 1. Windows--Preferences--Java--Compiler(配置的为1.8)--Installed JR ...

  6. idea java编译报错_intellij-idea,java_idea 编译报错,intellij-idea,java - phpStudy

    idea 编译报错 简单的 helloworld 竟然坑了我一天啦 /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bi ...

  7. 新的ipad,用xcode编译报错 dyld_shared_cache_extract_dylibs

    删掉  ~/Library/Developer/Xcode/iOS DeviceSupport/ 这个目录下的特定文件夹就行啦. 其实是因为  device is busy  生成文件夹过程中拔掉了设 ...

  8. cordova编译报错:Execution failed for task ':processDebugResources'

    cordova编译报错:Execution failed for task ':processDebugResources' 引发这个错误的最扩祸首就是一个中文命名的文件,不知道什么时候加入的,我写了 ...

  9. Android 编译报错:Could not get resource

    编译报错: Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'. Could not d ...

最新文章

  1. 原来被原子弹炸到是这种感觉!也太刺激了吧!
  2. Linux下使用system()函数一定要谨慎
  3. delete from t引发的血案
  4. golomb哥伦布编码——本质上就是通过0来区分商和余数
  5. 知己知彼 防范攻击:网络攻击步骤与黑客攻击原理
  6. 欢迎使用CSDN-markdown编辑器啦啦啦啦啦
  7. AIgorand的基本原理
  8. Edit Control中追加文字
  9. android device action and adb command
  10. 搭建和测试 Redis 主备和集群
  11. B/S架构 Web打印程序(Argox)
  12. mysql主主互备模式配置
  13. ESET Smart Security 3.0667与WindowsXP Sp3冲突
  14. wine QQ安装笔记
  15. jq ajax读取txt,使用JQuery或Ajax加载.txt文件
  16. java方法集:大写金额转换数字
  17. python的flask框架
  18. 全加器——Verilog HDL语言
  19. Continued Fraction(https://acs.jxnu.edu.cn/problem/ICPCJX2021B)
  20. 域名购买amp;备案amp;解析

热门文章

  1. 【dbt】配置表注释、字段注释
  2. jqury 获取第三个_使您的手机游戏成功。 第三部分:获取用户
  3. python gui Gooey 报错 error: argument command: invalid choice:
  4. vux如何实现伸缩面板
  5. IOS开发-蓝牙实战项目-汪亮-专题视频课程
  6. python已知两边求第三边_探究“已知一个三角形两边及其夹角,求第三边”的问题...
  7. ESP32开发一_开发环境
  8. 软件测试工程师在职研究生,​运维工程师考在职研究生有什么报考条件?
  9. mediasoup 源码分析(十九)dtls 握手
  10. Nginx https 证书自己生成