I have a a function definition that can be compiled with both MinGW or Visual C compiler. I need to define flags for the compiler.

See below, functionA has different definition for Visual C and MinGW compiler.

This is how I define flag in the .pro file
Qt Code:
  1. QMAKE_CFLAGS += -O2 -DVISUAL_STUDIO
To copy to clipboard, switch view to plain text mode 

This is in my code

Qt Code:
  1. #ifdef VISUAL_STUDIO
  2. int functionA(
  3. ...........
  4. #else
  5. static inline int functionA(
  6. ..........
To copy to clipboard, switch view to plain text mode 

I get the following two warning:
:-1: warning: D9024 : unrecognized source file type 'VISUAL_STUDIO', object file assumed
:-1: warning: D9027 : source file 'VISUAL_STUDIO' ignored


Any idea how to do this?