201401222234Command line option and macro preprocessor

-D name
Predefine name as a macro, with definition 1.

example
-DONLINE_JUDGE

match
cood in files
#ifdef ONLINE_JUDGE

...

#endif

 

c++ file:

#include<stdio.h>
#include<stdlib.h>

int main()
{
  #ifdef ONLINE_JUDGE
  puts("-DONLINE_JUDGE\n");
  #endif
  return 0;
}

 

compile, command line:

gcc gcc_macro_test.cpp -o gcc_macro_test.exe -DONLINE_JUDGE

run:

gcc_macro_test.exe

 

see the output of your program

沒有上一則|日誌首頁|沒有下一則
回應
JavaStricpt測試欄
好站分享
關鍵字
[此功能已終止服務]
    沒有新回應!