Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 25th, 2006, 9:16 PM   #1
weeb0
Newbie
 
Join Date: Jan 2006
Posts: 17
Rep Power: 0 weeb0 is on a distinguished road
Question multiple types in one declaration ?????

Hi,

I have the following class in an header file

 1: #ifndef ERROR_THROWS
 2: #define ERROR_THROWS
 3:
 4: class cserial_throws
 5: {
 6: public:
 7:	 char message_t[1024];
 8:	 int error_number;
 9: };
10:
11: #endif

when I use the definition and include the header in my project, I get the following message from the g++ compiler:

error_throws.h :9: error: multiple types in one declaration

Do somebody know what could be the problem ?

thank you!
weeb0 is offline   Reply With Quote
Old Jan 26th, 2006, 12:12 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
My guess is that, before you #include this file, you have code (or #include other headers) that #define's macros or types that interact with your declaration. It could also be a sign of a missing semi-colon in that preceding code.

The missing semi-colon in preceding code is pretty high on the list, so check that first. Easily fixed, but complain bitterly to the author of that code if it's in a library header. Then check to see if the names ERROR_THROWS (not I'm not kidding), cserial_throws, message_t, or error_number are declared somewhere else. If I had to pick the most likely culprit among those it would be message_t: such a name is often used internally in some library code as a type identifer (and, IIRC, gnu provide a mailutil library than has a message_t type). Then rename things accordingly.

If all that fails to turn up something, look for definitions of C/C++ keywords (eg int) in preceding code. And complain bitterly to authors of that code: they are introducing undefined behaviour.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC