#if的使用

if 后面接的是表达式

#if a==1
code
……
#endif

如果#if后面的表达式能成立,就会把#if和#endif之间的代码编译进去

#if defined的使用

#if defined (x)
code
……

如果x这个宏又被定义过,则把#if和#endif之间的代码编译进去

注意点

  1. 两个都只是用来决定某段代码是否被编译
  2. 记得加#endif

#if、#if defined 的使用的更多相关文章

  1. No result defined for action com.lk.IndexAction and result success

    意图访问一个 /es/index.action 竟然出现: [SAE ] ERROR [05-11 13:54:32] [http-80-5] com.opensymphony.xwork2.util ...

  2. Apache报错信息之Invalid command 'Order', perhaps misspelled or defined by a module not included in the server config

    今天配置开启Apache虚拟主机时, 然后日志报错提示: Invalid command 'Order', perhaps misspelled or defined by a module not ...

  3. _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)

    原文地址::http://blog.csdn.net/xiaolongwang2010/article/details/7550505 相关网帖 1.错误找不到WinsdkVer.h----http: ...

  4. VC++ : error LNK2005: ... already defined in *.obj

    今天写代码遇到了这么一个链接错误:"已经在*.obj中定义". error LNK2005: "void __cdecl ReplaceWstringVar(class ...

  5. Target runtime com.genuitec.runtime.generic.jee60 is not defined

    转载自:http://jingyan.baidu.com/article/d7130635338e3f13fdf47518.html 用eclipse加载别人的工程,报错Target runtime ...

  6. TOMCAT-报错The BASEDIR environment variable is not defined correctly

    <span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...

  7. MySql.Data.MySqlClient.MySqlException: Parameter ‘@maxid’ must be defined

    本文涉及到的mysql知识点: mysql中的if条件语句用法: IF(expr1,expr2,expr3) mysql使用变量(mysql中变量不用事前申明) mysql事务 testcase 为了 ...

  8. SQL SERVER中用户定义标量函数(scalar user defined function)的性能问题

    用户定义函数(UDF)分类  SQL SERVER中的用户定义函数(User Defined Functions 简称UDF)分为标量函数(Scalar-Valued Function)和表值函数(T ...

  9. no result defined for action

    1.no result defined for action .......and result input    或者 no result defined for action .......and ...

  10. 解决:Error: JAVA_HOME is not defined correctly

    问题重现: Error: JAVA_HOME is not defined correctly. We cannot execute :/usr/lib/jvm/java-7-oracle 问题分析: ...

随机推荐

  1. Linux入门-2 VIM基础

    启动与退出 模式 进入插入模式 命令 删除.复制.粘贴 光标控制 查找与替换 EX模式 启动与退出 vim只启动vim vim <filename>打开文件,如果不存在则新建 模式 Nor ...

  2. docker commit 显示“invalid reference format”

    docker commit的时候一直显示invalid reference format,改了几次也不行,后来发现是因为docker镜像的名字中不能包含大写字母,改成小写后就行了

  3. July 20th 2017 Week 29th Thursday

    The darkness is no darkness with you. 有了你,黑暗将不再是黑暗. The darkness will not be driven out if we failed ...

  4. easyui学习笔记3—在展开行内的增删改操作

    这一篇介绍在一个展开行内进行的增删操作,如果一行很长有很多的数据,在一个展开行内进行编辑将更加方便. 1.先看引用的资源 <link rel="stylesheet" hre ...

  5. 贝叶斯网络(Bayesian network))简介(PRML第8.1节总结)概率图模型(Graphical models)

    转:http://www.cnblogs.com/Dzhouqi/p/3204353.html 部分图为手写,由于本人字很丑,望见谅,只是想把PRML书的一些部分总结出来,给有需要的人看,希望能帮到一 ...

  6. tp5中分页携带参数的方法

    $list = $model->where(...)->order(.....)->paginate($size, false, [                'query' = ...

  7. 百度地图隐藏LOGO显示

    在引入地图的页面加入下列样式即可隐藏百度地图左下角的LOGO   <style type="text/css">   .anchorBL{display:none;} ...

  8. UVa 1220 - Party at Hali-Bula(树形DP)

    链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  9. window使用结束进程

    在cmd中输入下面信息: 1. 查看所有进程占用的端口 :netstat -ano 2.查看占用指定端口的程序:netstat –ano|findstr 指定端口号 3.杀死相关的进程: 方法一:使用 ...

  10. SimpleProfile_GetParameter && SimpleProfile_SetParameter

    /********************************************************************* * @fn SimpleProfile_GetParame ...