libev __GNUC__ __cplusplus

本文详细介绍了libev的安装过程,包括配置、编译和安装步骤,并解释了__GNUC__、__cplusplus宏的作用以及预定义宏的功能。

libev的安装

 

1、./configure--prefix=/usr           //指定安装路径,若不指定,会默认安装到/usr/local

 

2、make

 

3、make install

 

 

 __GNUC__是linux内置的一个宏

用于在跨平台编程时识别linux

有时候编译时__GNUC__不能识别,可以在makefile里显示把宏开启-D__GNUC__ 编译通过。

 

 

 

#ifdef  __cplusplus

extern  "C "   {

#endif

…………

…………

#ifdef  __cplusplus

}

#endif

 

在CPP文件中让编译器以c语言编译就要用这个宏

如果编译起在编译cpp文件那么__cplusplus   就会被定义   如果是一个c文件在被编译那么__STDC__就会被定义

 

Predefined  Macros

The  translator   predefines   several  macro   names.

 

The  macro   __DATE__   expands  to   a   string  literal   that   gives  the   date   you  invoked   the   translator.  Its   format   is  "Mmm   dd   yyyy ".   The  month   name   Mmm  is   the   same  as   for   dates  generated   by   the  library   function   asctime.  The   day   part  dd   ranges   from  "   1 "   to  "31 "   (a   leading  0   becomes   a  space).

 

The  macro   __FILE__   expands  to   a   string  literal   that   gives  the   remembered   filename  of   the   current  source   file.   You  can   alter   the  remembered   filename   by  writing   a   line  directive.

 

The  macro   __LINE__   expands  to   a   decimal  integer   constant   that   gives  the   remembered   line  number   within   the  current   source   file.  You   can   alter  the   remembered   line  number   by   writing  a   line   directive.

 

The  macro   __STDC__   expands  to   the   decimal  integer   constant   1.  The   translator   should  provide   another   value  (or   leave   the  macro   undefined)   when  you   invoke   it  for   other   than  a   Standard   C  environment.   For   example,  you   can   write:

 

#if  __STDC__   !=   1

 #error   NOT   a  Standard   C   environment

#endif

The  macro   __STDC_VERSION__   expands  to   the   decimal  integer   constant   199409L.  The   translator   should  provide   another   value  (or   leave   the  macro   undefined)   when  you   invoke   it  for   other   than  a   Standard   C  environment   that   incorporates   Amendment  1.

 

The  macro   __TIME__   expands  to   a   string  literal   that   gives  the   time   you  invoked   the   translator.  Its   format   is  "hh:mm:ss ",  which   is   the  same   as   for  times   generated   by  the   library   function  asctime

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值