#include < iostream >  
 #define MY_CHK_DEF(flag) \
 #ifdef (flag) \
    std::cout<<#flag<<std::endl; \
 #else \
    std::cout<<#flag<<" ,flag not define"<<std::endl; \
 #endif 
 int main()
 {
    MY_CHK_DEF(FLAG_1);
    MY_CHK_DEF(FLAG_2);
    MY_CHK_DEF(FLAG_3);
    ...  
 }
complier report:
main.cpp:3:24: error: '#' is not followed by a macro parameter
any ideas?
Thanks
You actually can do this if you use BOOST processor header lib.. it provides a BOOST_PP_IF macro allow this type of decisions.
http://www.boost.org/doc/libs/1_53_0/libs/preprocessor/doc/ref/if.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With