Macro does not compile

clive@emultek.co.il clive@emultek.co.il
Mon Jun 14 23:00:00 GMT 1999


The compilation results for this Macro are shown after it.
#define DECLARE_CLASS(n)                                       \
class MyClass##n                                 \
{                                                              \
public:                                                        \
 MyClass##n (int i);                                       \
 ~MyClass##n (void);                                             \
private:                                                       \
 char *_dum;                                              \
};
DECLARE_CLASS(10)


Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ test.cpp /tmp/ccjEedhr.ii
GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus
/tmp/ccjEedhr.ii -quiet -dumpbase test.cc -version -o /tmp/ccOnnPJQ.s
GNU C++ version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
(i386-redhat-linux) compiled by GNU C version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release).
In file included from test.cpp:1:
test.h:3: parse error before `#'
test.h:3: stray '\' in program
test.h:4: stray '\' in program
test.h:5: stray '\' in program
test.h:6: stray '\' in program
test.h:7: destructors must be member functions
test.h:7: syntax error before `#'
test.h:7: stray '\' in program
test.h:8: stray '\' in program
test.h:9: stray '\' in program
test.h:12: stray '\' in program




More information about the Gcc-bugs mailing list