title: how to use #if,#else,#endif... inside c macro
body: <pre><code> #include &lt; iostream &gt;  
  
   #define MY_CHK_DEF(flag) \
   #ifdef (flag) \
      std::cout&lt;&lt;#flag&lt;&lt;std::endl; \
   #else \
      std::cout&lt;&lt;#flag&lt;&lt;" ,flag not define"&lt;&lt;std::endl; \
   #endif 
  
  
   int main()
   {
      MY_CHK_DEF(FLAG_1);
      MY_CHK_DEF(FLAG_2);
      MY_CHK_DEF(FLAG_3);
      ...  
   }
  </code></pre>
  
  <p>complier report:</p>
  
  <p>main.cpp:3:24: error: '#' is not followed by a macro parameter</p>
  
  <p>any ideas?</p>
  
  <p>Thanks</p>