-D_GNU_SOURCE

来源:互联网 发布:mac双系统修改启动顺序 编辑:程序博客网 时间:2024/05/14 10:50

 _GNU_SOURCE: glibc does not make the GNU extensions available automatically. If a program depends on GNU extensions or some other non-standard functionality, it is necessary to compile it with the C compiler option -D_GNU_SOURCE, or better, to put `#define _GNU_SOURCE' at the beginning of your source files, before any C library header files are included. This difference normally manifests itself in the form of missing prototypes and/or data type definitions. Thus, if you get such errors, the first thing you should do is try defining _GNU_SOURCE and see if that makes the problem go away.
For more information consult the file `NOTES' in the GNU C library sources.

对于Linux下的信号量/读写锁文件进行编译,需要在编译选项中指明-D_GNU_SOURCE

 

原创粉丝点击