Q: macro passed from compile cannot be resolved in eclipse I am trying to pass a defined macro to my program at compile time like this:
#include <stdio.h>
int main() {
    // KEY_CNT is not defined in program but passed at compile time
    printf("KEY_CNT: %d", KEY_CNT); 
    return 0;
}

and compile with g++ -DKEY_CNT=2 -O2 test_3.cpp -o test_3 and it works as expected, but the problem is Eclipse cannot resolve 'KEY_CNT'. This is just a toy example, in my original program, many false errors like this with red lines are really annoying. 
I think Eclipse might need to be notified of my compile option so that it knows 'KEY_CNT' is defined, so I add -DKEY_CNT=2 in Properties -> C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous, but it still doesn't work.
Any advice to solve this? 
======== added ========
Eclipse version: Eclipse IDE for C/C++ Developers, Luna Service Release 2 (4.4.2)

A: 
Properties -> C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous

Wrong place.
Should be "C/C++ Build -> Settings -> GCC C++ Compiler -> Preprocessor"
Just verified it works.
