您的位置:首页 > 其它

gcc -D选项 编译时添加宏定义

2018-01-03 11:54 387 查看
//test.cpp
#include <stdio.h>  

#include <stdlib.h>  

  

int main(int argc, char* argv[])  

{  

      

#ifndef
NO_DEBUG

    printf("gcc -D\n");  

#endif  

  

    return 0;  

}

//Makefile
DEBUG=

CFLAGS=-g $(DEBUG)

all:a.out
g++ CFLAGS -o a.out

//make
make DEBUG='-D NO_DEBUG'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: