On 2/11/2014 1:55 AM, garthh wrote:
This simple piece of code doesn't compile for me in boost 1.54 on MacOSX:
#include
#define debugprintf(...) \
printf(BOOST_PP_SEQ_ELEM(0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)))
main ()
{
debugprintf("test");
}
I've spent ages on it without success. Any suggestions would be greatly
appreciated!
Compile output:
error: too few arguments provided to function-like macro invocation
debugprintf("boost test");
^
main.cpp:15:17: note: expanded from macro 'debugprintf'
fprintf(stderr, BOOST_PP_SEQ_ELEM(0,
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)));
\
^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:22:39: note:
expanded from macro 'BOOST_PP_SEQ_ELEM'
# define BOOST_PP_SEQ_ELEM(i, seq) BOOST_PP_SEQ_ELEM_I(i, seq)
^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:41:45: note:
expanded from macro 'BOOST_PP_SEQ_ELEM_I'
# define BOOST_PP_SEQ_ELEM_I(i, seq)
BOOST_PP_SEQ_ELEM_II(BOOST_PP_SEQ_ELEM_ ## i seq)
^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:43:62: note:
expanded from macro 'BOOST_PP_SEQ_ELEM_II'
# define BOOST_PP_SEQ_ELEM_II(im) BOOST_PP_SEQ_ELEM_III(im)
^
main.cpp:21:2: error: use of undeclared identifier 'BOOST_PP_SEQ_ELEM_III'
debugprintf("boost test");
It is quite possible that Boost PP is not setting up your compiler with
variadic macro support. Would you please try:
#define BOOST_PP_VARIADICS 1
before your code and see if it now works. If it does you might want to
define BOOST_PP_VARIADICS to 1 on your compiler command line.