dimanche 27 août 2017

C++ multi line define directive error

After reading this question, I have the following code,

#define OSSPECIFICHANDLERTYPE { \
#ifdef SDL_VIDEO_DRIVER_WINDOWS \
HWND                            \
#endif                          \
#if defined(SDL_VIDEO_DRIVER_X11)   \
Window                              \
#endif                              \
#if defined(SDL_VIDEO_DRIVER_COCOA) \
NSWindow*                       \
#endif }

OSSPECIFICHANDLERTYPE s_hWndBase;

But it gives the following errors,

First,

main.cpp:64:1: error: expected expression

OSSPECIFICHANDLERTYPE s_hWndBase; ^

Second,

main.cpp:53:33: note: expanded from macro 'OSSPECIFICHANDLERTYPE' #define OSSPECIFICHANDLERTYPE { \

And third,

main.cpp:64:23: error: use of undeclared identifier 's_hWndBase' OSSPECIFICHANDLERTYPE s_hWndBase;

So where is the problem and how can I solve this ?

Aucun commentaire:

Enregistrer un commentaire