Search code examples
llvmclangllvm-gcc

LLVM equivalent of gcc -D macro definition on commandline


I am looking for LLVM (or clang) equivalent of gcc's -D flag which enables macro definition at commandline.

Any pointers would be great.


Solution

  • From clang --cc1 --help:

    ...
    -D <macro>=<value>      Define <macro> to <value> (or 1 if <value> omitted)
    ...
    

    As a rule of thumb, assume that Clang emulates GCC, unless proven otherwise!