There is this compilation error in my project. It uses wxWidgets version 3.0.3, and is compiled by GCC in Ubuntu 8.04.
/opt/wx/3.0/include/wx-3.0/wx/dlimpexp.h|20|error: expected class-name before ‘__attribute__’|
This error appears on the second of these two lines in the file dlimpexp.h:
# define WXEXPORT __attribute__ ((visibility("default")))
# define WXIMPORT __attribute__ ((visibility("default")))
This error means, as I understand it, that the "__attribute__" token is not recognized as a GCC attribute, but instead should be preceded with a class name to define what it is. Why it is that __attribute__ is undefined in the second line above, and seems to be defined in the second is a mystery to me. Yet the second line above is line number 20 in dlimpexp.h, and is where the error is indicated.
I also can't figure why there would be an error such as this in a macro definition, which is supposed simply replace every instance of "WXIMPORT" in the source code with what follows in its line.
This file is part of the wxWidgets 3.0.3 package I compiled on my computer.
I started this thread in this forum because I did not know whether this was a Code::Blocks problem or a wxWidgets problem.
The idea of wxWidgets is to be cross platform. A migration from Windows 7 to Ubuntu is supposed to be easy to do.
There are more things I have noticed. The error happens in the second define statement in this snippet from dlimpexp.h:
#if defined(HAVE_VISIBILITY)
# define WXEXPORT __attribute__ ((visibility("default")))
# define WXIMPORT __attribute__ ((visibility("default")))
#elif defined(__WINDOWS__)
Note that the first define line is nearly identical to the second. Only the name of the macro is different. When, as a test, I changed the name from WXIMPORT to WXIMPORTX the error on that line disappeared (there were many other errors elsewhere of course). There is something going on with the name WXIMPORT. Anyone know what?
class WXDLLIMPEXP_CORE wxComboBoxDataFile : public WXDLLIMPEXP_CORE wxComboBox
Why do you think the second WXDLLIMPEXP_CORE in your file Utilities.h is needed?
Edit2/3: The first WXDLLIMPEXP_CORE may or may not be needed; the second WXDLLIMPEXP_CORE I have great doubt is needed or is correct to have.
Edit1: Build log snippet added below.
include/Utilities.h:256:52: note: in expansion of macro ‘WXDLLIMPEXP_CORE’
class WXDLLIMPEXP_CORE wxComboBoxDataFile : public WXDLLIMPEXP_CORE wxComboBox
Tim S.