gcc 编译选项宏定义

xiaoxiao2021-02-28  116

gcc 编译时可以通过-D选项传递宏定义

#include <stdio.h> #ifndef S #define S "ab" #endif #ifndef A #define A 10 #endif void main() { char s[]=S; char a=A; printf("a:%d\n",a); printf("s:%s",s); } gcc -o test.exe test.c -DS=\"abc\" -DA=100

运行输出

a:100 s:abc

转载请注明原文地址: https://www.6miu.com/read-65874.html

最新回复(0)