我正在尝试使用 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
关于c++ - Coan 给出了带有定义符号的 "expands to nothing within expression",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40475159/