0


c99编译报错改用gnu99

使用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.

标签:

本文转载自: https://blog.csdn.net/wteruiycbqqvwt/article/details/115486276
版权归原作者 panamera12 所有, 如有侵权,请联系我们删除。

“c99编译报错改用gnu99”的评论:

还没有评论