/* 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
中删除了Pkg
和Houston1Pkg
。如何在路径中保留整个单词Houston1Pkg
?