Coan 给 "expands to nothing within expression" 定义了符号

Coan gives "expands to nothing within expression" with defined symbol

我正在尝试使用 coan 生成代码库的干净版本,但它在第一个定义的第一个源代码上崩溃了,使用:

coan source -DNON_SMS --filter c,h --recurse --replace test -V

我得到:

coan: progress 0x00101: Processing file (1) 
"D:\Documents\Downloads\test\cli.c"
coan: D:\Documents\Downloads\test\cli.c: line 53: error 0x00816: "NON_SMS" expands to nothing within expression, in "#if ( NON_SMS ) /* Non-SMS compile */"
coan: progress 0x02101: Completed with errors, exit code 0x04
coan: info 0x02201: 1 out of 41 input files were reached; 40 files were not reached
coan: info 0x02202: 0 out of 1 files reached were valid; 1 were abandoned due to parse errors

但是代码在 MSVS 上运行正常,这条语句其实很简单:

#if       ( NON_SMS )                   /*  Non-SMS compile  */

#include  <stdlib.h>                    /*  Standard library definitions   */
#include  <string.h>                    /*  String related definitions     */

#else    

这是在 Windows 7 x64 上。

Coan 期望当代码像

#if (MACRO)

MACRO 会有一个值——如果你只是想测试宏是否被定义,你会写

#ifdef MACRO

所以你需要给NON_SMS一个值,例如

coan source -DNON_SMS=1 --filter c,h --recurse --replace test -V