![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Posts: 17
Rep Power: 0
![]() |
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: #endifwhen 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! |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|