//在vs2008下編譯通過
#include <iostream> #include<fstream> #ifndef OPTION_LONG//預處理定義 #define OPTION_LONG 1 #define OPTION_DETAILED 0 #endif static int print_ledger_long(int rhs)//定義條件函數 { std::cout<<rhs<<std::endl; return rhs; } int main(int argc, char* argv[]) { #if OPTION_LONG//條件編譯 print_ledger_long(5); #elif print_ledger_long(4); #endif//條件編譯結束 system("pause"); return 0; }