LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1785|回复: 4

G++有什么选项能让程序执行#if debug #endif中间的代码呀???

[复制链接]
发表于 2006-8-3 18:16:00 | 显示全部楼层 |阅读模式
G++有什么选项能让程序执行#if debug   #endif中间的代码呀???
发表于 2006-8-3 18:43:24 | 显示全部楼层
  1. /* test.c */
  2. #include <stdio.h>
  3. int main()
  4. {
  5. #ifdef debug
  6.     printf("hello\n");
  7. #endif
  8.     return 0;
  9. }
复制代码

编译: gcc test.c -Ddebug
回复 支持 反对

使用道具 举报

发表于 2006-8-3 18:46:21 | 显示全部楼层
我刚才试了一下,加了个-Ddebug就能编译#if debug #endif之间的代码了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-3 19:18:24 | 显示全部楼层
谢谢,可以用了。
回复 支持 反对

使用道具 举报

发表于 2006-8-5 22:07:40 | 显示全部楼层
-D debug
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表