右击工程--build option--compile setting--#defines里面加入 __define 再代码里就可以: #ifdef __define printf("11\n"); #endif