在宏定义中如何添加__FUNCTION__? 代码如下: #include void _LOG(const char* strFormat, ...) { printf("res=%s\n", strFormat); } #define LOG(strFormat, ...) _LOG(__FUNCTION__ ":" strFormat, ##__VA_ARGS__) //在这里添加__FUNCTION__后编译会报错,添加其它字符串就不会报错。 int main() { LOG("%s", "Hello, world!"); return 0; } 尝试将__FUNCTION__改为字符串就不会报错。