+ -
当前位置:首页 → 问答吧 → c99中编译getopt警告?

c99中编译getopt警告?

时间:2010-08-03

来源:互联网

出现如下的警告:
implicite declaration of function 'lstat'
implicite declaration of function 'getopt'

显然我已经包含了头文件,但是在使用gcc -std=c99..... 编译,就会出现上述警告。请教为甚如此?


谢先。

作者: zhanglistar   发布时间: 2010-08-03

C99的时候这些函数声明都被条件编译屏蔽了,因为这些函数并不是C99标准里面的

你使用-std=c99时加上 -D_POSIX_C_SOURCE=200112L 定义

或者不要使用-std=c99,而使用-std=gnu99

也许可以,记不太清了。。

作者: 雨过白鹭洲   发布时间: 2010-08-03

回复 雨过白鹭洲


    yes  使用gnu99  是可以的 ,骤然没了警告。

作者: zhanglistar   发布时间: 2010-08-03

相关阅读 更多