gcc -D:gcc的预定义功能
来源:互联网 发布:网络连接错误代码118 编辑:程序博客网 时间:2024/05/12 15:25
gcc编译的时候提供了预定义功能,参数是-D, 通过man gcc可以了解更多:
-D name
Predefine name as a macro, with definition 1.
-D name=definition
Predefine name as a macro, with definition definition. The contents of definition are tokenized and processed as if they appeared during translation phase three in a #define directive. In particular, the definition will be truncated by embedded new-line characters.
可以通过以下例子解释一下:
int main()
{
#ifdef HELLO
printf("HELLO defined\n");
#else
printf("HELLO not define\n");
#endif
return 0;
}
在该程序中,判断是否已经定义了宏DEBUG,从而输出相应的语句。
如果编译该程序时采用了gcc -DHELLO, 则输出:HELLO defined
-D name
Predefine name as a macro, with definition 1.
-D name=definition
Predefine name as a macro, with definition definition. The contents of definition are tokenized and processed as if they appeared during translation phase three in a #define directive. In particular, the definition will be truncated by embedded new-line characters.
可以通过以下例子解释一下:
int main()
{
#ifdef HELLO
printf("HELLO defined\n");
#else
printf("HELLO not define\n");
#endif
return 0;
}
在该程序中,判断是否已经定义了宏DEBUG,从而输出相应的语句。
如果编译该程序时采用了gcc -DHELLO, 则输出:HELLO defined
0 0
- gcc -D:gcc的预定义功能
- gcc -D:gcc的预定义功能 [gcc -o cinfo -DDEBU cinfo.c / gcc -o cinfo -D DEBU cinfo.c]
- gcc预定义宏
- gcc预定义的一些宏
- GCC 上的预定义宏
- 查看gcc预定义的宏
- GCC 的宏预定义列表
- gcc中预定义的宏__GNUC__
- MakeFile添加ifdef中参数的方法(其实是GCC种的预定义功能)
- 查看gcc所定义的所有预定义宏
- 查看gcc预定义宏(predefined macro)的方法
- GCC中常见预定义宏的使用
- GCC中常见预定义宏的使用
- 查看gcc预定义宏(predefined macro)的方法
- 查看gcc所定义的所有预定义宏
- 查看gcc预定义宏(predefined macro)的方法 .
- 如何查看Linux GCC编译器里预定义的宏
- GCC中常见预定义宏的使用
- [哈希]PAT1039 Course List for Student
- linux下使用JMX监控tomcat
- 不习惯的时候就是成长的时候
- 为什么用CDC定义指针绘图,而不用对象
- 【策略模式-strategy】
- gcc -D:gcc的预定义功能
- 跟我一起写Makefile(四):书写命令
- JDK版本的发布时间表
- 设置中在fragment中启动fragment流程及log输出
- jQuery hover(over, out)事件函数
- Windows下完整下载Android源代码
- 一句话小结
- 胖子第二版
- sscanf()的一些使用说明