| View previous topic :: View next topic |
| Author |
Message |
Chris Guest
|
Posted: Mon Dec 18, 2006 9:10 am Post subject: Declaration terminated incorrectly |
|
|
Hi
I get the following error
[C++ Error] dxUxTheme.hpp(70): E2040 Declaration terminated incorrectly
for this line
static const Shortint DTT_GRAYED = 0x1;
I believe that this is actually caused by a naming conflict with MS's theme
header as if I rename the constant the error goes. I have simply commented
out the consts that lead to the error and all seems to be working correctly
but I wonder what the correct way of handling this really is?
Best regards
Chris F |
|
| Back to top |
|
 |
Duane Hebert Guest
|
Posted: Mon Dec 18, 2006 5:07 pm Post subject: Re: Declaration terminated incorrectly |
|
|
"Alan Bellingham" <alanb (AT) episys (DOT) com> wrote in message
news:n1nco2pd3ecnjsqi0tsjssrfpcjj376f4c (AT) 4ax (DOT) com...
| Quote: | "Chris" <nospam (AT) nospam (DOT) com> wrote:
I get the following error
[C++ Error] dxUxTheme.hpp(70): E2040 Declaration terminated incorrectly
for this line
static const Shortint DTT_GRAYED = 0x1;
I believe that this is actually caused by a naming conflict with MS's
theme
header as if I rename the constant the error goes. I have simply
commented
out the consts that lead to the error and all seems to be working
correctly
but I wonder what the correct way of handling this really is?
It's likely that DTT_GRAYED is a macro definition - it's all upper-case.
Trying to declare an initialiser with the name of a pre-existing macro
will tent to give you such errors, so it's a good idea never to do it.
How to avoid macro names? It's relatively easy - never use those names
conventionally reserved to macros. You broke that rule here, possibly
because you weren't aware of it.
The rule is - macros are ALL upper-case, nothing else is.
Unhappily, it's frequently broken by Microsoft, who even use all
uppercase for type names.
|
and all lower case for macros. |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Mon Dec 18, 2006 5:14 pm Post subject: Re: Declaration terminated incorrectly |
|
|
"Duane Hebert" <spoo (AT) flarn2 (DOT) com> wrote:
| Quote: | "Alan Bellingham" <alanb (AT) episys (DOT) com> wrote in message
Unhappily, it's frequently broken by Microsoft, who even use all
uppercase for type names.
and all lower case for macros.
|
Indeed.
OK, so there are a couple of places where standard C uses lower case
macros - assert() is the most obvious - but you really don't want to see
my undefs.h header file which very carefully undoes all those Microsoft
macros and replaces the relevant functions with overloaded equivalents.
Alan Bellingham
--
ACCU Conference: 11-14 April 2007 - Paramount Oxford Hotel |
|
| Back to top |
|
 |
vavan Guest
|
Posted: Mon Dec 18, 2006 5:25 pm Post subject: Re: Declaration terminated incorrectly |
|
|
On Mon, 18 Dec 2006 11:14:09 +0000, Alan Bellingham <alan (AT) lspace (DOT) org>
wrote:
| Quote: | macros - assert() is the most obvious - but you really don't want to see
my undefs.h header file which very carefully undoes all those Microsoft
|
quite the contrary I believe that would be very interesting for those
who suffering from all that ms-macrohell to see your undefs :)
--
Vladimir Ulchenko aka vavan |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Mon Dec 18, 2006 5:43 pm Post subject: Re: Declaration terminated incorrectly |
|
|
vavan <VavanRemove (AT) ThisSantel (DOT) ru> wrote:
| Quote: | quite the contrary I believe that would be very interesting for those
who suffering from all that ms-macrohell to see your undefs
|
*grin*
I don't want to see it, then!
Alan Bellingham
--
ACCU Conference: 11-14 April 2007 - Paramount Oxford Hotel |
|
| Back to top |
|
 |
Chris Guest
|
Posted: Tue Dec 19, 2006 9:10 am Post subject: Re: Declaration terminated incorrectly |
|
|
"Alan Bellingham" <alanb (AT) episys (DOT) com> wrote in message
news:n1nco2pd3ecnjsqi0tsjssrfpcjj376f4c (AT) 4ax (DOT) com...
| Quote: |
It's likely that DTT_GRAYED is a macro definition - it's all upper-case.
Trying to declare an initialiser with the name of a pre-existing macro
will tent to give you such errors, so it's a good idea never to do it.
snip |
Thanks Alan.
As it happens I managed to find some google entries about this and it
appears that perhaps DevExpress (the DxUxTheme.hpp file is from them) should
be using $EXTERNALSYM.
Anyway, apparently wrapping the declarations with #if !defined(_UXTHEME_H_)
cures the problem.
Thanks again.
Chris |
|
| Back to top |
|
 |
Roddy Pratt Guest
|
Posted: Thu Dec 21, 2006 5:23 pm Post subject: Re: Declaration terminated incorrectly |
|
|
Alan - Your undefs.h sounds interesting. I've proposed something
similar here for some specific gotchas,
http://qc.borland.com/wc/qcmain.aspx?d=29106
- Roddy |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Thu Dec 21, 2006 6:55 pm Post subject: Re: Declaration terminated incorrectly |
|
|
"Roddy Pratt" <> wrote:
The problem I have is that undefs.h is 175,000+ lines in length. (I
could cut it way down by disabling a certain error message.)
| Quote: | #if defined(AnsiLowerBuff) // (4499:#define AnsiLowerBuff CharLowerBuffA)
# undef AnsiLowerBuff
#endif AnsiLowerBuff
|
Then I have another file, redefs.h, that I include, that looks like:
| Quote: | inline DWORD AnsiLowerBuff(char * Src, DWORD cchLength) { return CharLowerBuffA(Src, cchLength); }
inline DWORD AnsiLowerBuff(wchar_t* Src, DWORD cchLength) { return CharLowerBuffW(Src, cchLength); }
|
This one is much shorter, but only includes those functions I personally
have used and bothered to produce inliners for. And actually, I tend to
type the terminating A or W these days.
The problem with the Microsoft way of doing things is that it's targeted
to those using C. The C++ way - using inline forwarding to the relevant
target using overloading - is much less intrusive, but we don't have
proper C++ bindings.
Alan Bellingham
--
ACCU Conference: 11-14 April 2007 - Paramount Oxford Hotel |
|
| Back to top |
|
 |
|