The following is giving me a compiler error:
#include <foo.h>
#define ODP ( \
L"bar. " \ // C2059 here
L"baz.")
#define FF开发者_StackOverflow社区W (5)
What am I doing wrong?
You forgot the line splice characters
#define ODP ( \
\
L"bar. " \
\
L"baz.")
Not sure why you put those newlines though. It all gets down to
#define ODP (L"bar. baz.")
Note that the characters must be the last ones on the line. And you cannot put a line comment (//
) before them, because the line comment would extend to the next physical line. Use C Style comments if you still want to comment the lines separately
#define ODP ( \
/* this is bar */ \
L"bar. " \
/* this is baz */ \
L"baz.")
Other than the blank lines that are obvious, the hard one is the one you cannot see. A space or a tab after the backslash also produces this compile error.
精彩评论