Hi!
My C::B svn 7452 with Mingw and wx2.8.12 (installed off the C: root) doesn't want to compile any project that has references to wxWidget headers (OS Windows XP SP3). Specifically, a newly create "OpenGL" project with the default code fails when compiling with the following errors from mingw:
||=== OpenGL_Test1, Debug ===|
C:\wxWidgets-2.8.12\include\wx\buffer.h|127|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxCharBuffer'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|129|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxWritableCharBuffer'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|134|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxWCharBuffer'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|136|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxWritableWCharBuffer'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|152|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxWxCharBuffer'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|165|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMemoryBufferData'|
C:\wxWidgets-2.8.12\include\wx\buffer.h|222|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMemoryBuffer'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|52|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConv'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|171|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvLibc'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|231|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF7'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|244|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF8'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|268|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF16Base'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|287|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF16LE'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|301|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF16BE'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|315|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF32Base'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|333|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF32LE'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|347|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF32BE'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|363|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxCSConv'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|425|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|428|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|429|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|430|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|439|error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|446|error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|449|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|455|error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token|
C:\wxWidgets-2.8.12\include\wx\strconv.h|465|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF16'|
C:\wxWidgets-2.8.12\include\wx\strconv.h|466|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxMBConvUTF32'|
C:\wxWidgets-2.8.12\include\wx\string.h|58|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxString'|
C:\wxWidgets-2.8.12\include\wx\string.h|104|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'IsEmpty'|
C:\wxWidgets-2.8.12\include\wx\string.h|176|error: string: No such file or directory|
C:\wxWidgets-2.8.12\include\wx\string.h|186|error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token|
C:\wxWidgets-2.8.12\include\wx\string.h|223|error: expected ':', ',', ';', '}' or '__attribute__' before 'const'|
C:\wxWidgets-2.8.12\include\wx\string.h|252|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxStringBase'|
C:\wxWidgets-2.8.12\include\wx\string.h|659|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxString'|
C:\wxWidgets-2.8.12\include\wx\string.h|1421|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1422|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1423|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1424|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1425|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1438|error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token|
C:\wxWidgets-2.8.12\include\wx\string.h|1503|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxStringBuffer'|
C:\wxWidgets-2.8.12\include\wx\string.h|1521|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'wxStringBufferLength'|
C:\wxWidgets-2.8.12\include\wx\string.h|1560|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1562|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1564|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1566|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1568|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1570|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
C:\wxWidgets-2.8.12\include\wx\string.h|1572|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'operator'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 16 seconds) ===|
Now I've notices that many wx 2.8.12 headers have huge macros to declare classes (which is in fact one of the things that Bjarne Stroustrup disparages angrily in all his books on C++), like in "wx/buffer.h":
#define DEFINE_BUFFER(classname, chartype, strdupfunc) \
class WXDLLIMPEXP_BASE classname \
{ \
public: \
classname(const chartype *str = NULL) \
: m_str(str ? strdupfunc(str) : NULL) \
{ \
} \
\
classname(size_t len) \
: m_str((chartype *)malloc((len + 1)*sizeof(chartype))) \
{ \
m_str[len] = (chartype)0; \
} \
\
/* no need to check for NULL, free() does it */ \
~classname() { free(m_str); } \
\
chartype *release() const \
{ \
chartype *p = m_str; \
((classname *)this)->m_str = NULL; \
return p; \
} \
\
void reset() \
{ \
free(m_str); \
m_str = NULL; \
} \
\
classname(const classname& src) \
: m_str(src.release()) \
{ \
} \
\
classname& operator=(const chartype *str) \
{ \
free(m_str); \
m_str = str ? strdupfunc(str) : NULL; \
return *this; \
} \
\
classname& operator=(const classname& src) \
{ \
free(m_str); \
m_str = src.release(); \
\
return *this; \
} \
\
bool extend(size_t len) \
{ \
chartype * \
str = (chartype *)realloc(m_str, (len + 1)*sizeof(chartype)); \
if ( !str ) \
return false; \
\
m_str = str; \
\
return true; \
} \
\
chartype *data() { return m_str; } \
const chartype *data() const { return m_str; } \
operator const chartype *() const { return m_str; } \
chartype operator[](size_t n) const { return m_str[n]; } \
\
private: \
chartype *m_str; \
}
#if wxABI_VERSION >= 20804
// needed for wxString::char_str() and wchar_str()
#define DEFINE_WRITABLE_BUFFER(classname, baseclass, chartype) \
class WXDLLIMPEXP_BASE classname : public baseclass \
{ \
public: \
classname(const baseclass& src) : baseclass(src) {} \
classname(const chartype *str = NULL) : baseclass(str) {} \
\
operator chartype*() { return this->data(); } \
}
#endif // wxABI_VERSION >= 20804
DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
#if wxABI_VERSION >= 20804
DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
#endif
// ...
As I understand, these macro declarations just don't go well with mingw / gcc... Or what? How can I get projects to compile, anyway?