对包含带数字的单词的C宏进行字符串化

时间:2015-01-14 22:53:57

标签: c

/* Example.h */

#define QUOTE(str)                      #str
#define EXPAND_AND_QUOTE(str)           QUOTE(str)

#define HOUSTON_INCLUDE_PATH            u:/PlatformPkgs/HoustonPkg/Include
#define HOUSTON1_INCLUDE_PATH           u:/PlatformPkgs/Houston1Pkg/Include

// HOUSTON1 is defined in CFLAGS with /DHOUSTON1
#if defined(HOUSTON)   
#include EXPAND_AND_QUOTE(HOUSTON_INCLUDE_PATH/Optional.h)
#elif defined (HOUSTON1)
#include EXPAND_AND_QUOTE(HOUSTON1_INCLUDE_PATH/Optional.h)
#endif

得到以下编译错误:

C1083: Cannot open include file: 'u:/PlatformPkgs/1/Include/Optional.h': No such file or directory

错误是由于宏扩展到u:/PlatformPkgs/1/Include/Optional.h。它在Houston中删除了PkgHouston1Pkg。如何在路径中保留整个单词Houston1Pkg

0 个答案:

没有答案