宏定义与空格 在宏定义中,如果宏有多行,每行的后面必须有\,但是切忌\后不能有空格。 下面的正确实例: #include " stdafx.h " #include < iostream > #include < string > const std:: string c_A = " A " ; const std:: string c_B = " B " ; #define INSERT_FUNCTION(NAME) \ inline void \Insert ## NAME( const std:: string & valuestr) \ { \ std::cout << c_ ## NAME << valuestr << std::endl; \} \INSERT_FUNCTION(A)INSERT_FUNCTION(B) #undef INSERT_FUNCTION int _tmain( int argc, _TCHAR * argv[]) { InsertA("value:i am a!"); InsertB("value:i am b!"); return 0;} 在vs2005中,使用ctrl+R+w开打开和关闭空格显示,在打开空格显示后你就可以看到你的\后面到底是不是多了空格