[Solved]Where does Qt define the __VA_ARGS__ macro ?
-
wrote on 19 Aug 2012, 02:35 last edited by
Hi, I want to define a variadic macro like:
@#define LOG(fmt, ...) printf(fmt, ##VA_ARGS)@Both "##" and "VA_ARGS"can not pass the compiler. Does Qt support the variadic macro? If so, which header I should include?
Thanks,
Stuart
-
wrote on 19 Aug 2012, 07:47 last edited by
Your compiler needs to support variadic macros. Qt can not make them work for you.
-
wrote on 19 Aug 2012, 15:18 last edited by
Tobias, you are right. The compiler, i.e. gcc, comes with the platform, not with the Qt. Thank you very much.
I am using Mac OS X. I tried <stdio.h> and <stdarg.h>, no luck yet. Any one can tell me which header defines this "VA_ARGS" macro?
Thanks,
Stuart
-
wrote on 19 Aug 2012, 18:25 last edited by
It turns out that I mistakenly try to use this "VA_ARGS" in a function directly.
I examined that both of the following format work in Qt program:
@#define LOG(fmt, ...) dbg_func(fmt, ##VA_ARGS)
#define LOG(fmt, args...) dbg_func(fmt, ##args)@Sorry for the annoying.
1/4