duplicate specifier in delcaration??

F

franco ziade

I am compiling a directiry of source files which include a header with the
following

typedef unsigned char u_char;

when i compile the following error occurs.

duplicate specifier in declaration

What can it be? what should i be looking for in the system which can cause
this error?

PS - we have changed the OS to vxWorks

thanks
 
V

vijoeyz

The type-definition seems perfectly OK. The word 'duplicate' could
mean that this type-definition is repeated.
 
K

Keith Thompson

franco ziade said:
I am compiling a directiry of source files which include a header with the
following

typedef unsigned char u_char;

when i compile the following error occurs.

duplicate specifier in declaration

What can it be? what should i be looking for in the system which can cause
this error?

That declaration looks ok. My best guess is that somewhere, probably
in a header that you include before the one with the typedef, the
identifier "u_char" is declared as a macro. For example, if "u_char"
expands to "unsigned char", the specifier "unsigned" appears twice.
(I don't get the same error message, but that's compiler specific, and
the expansion may be something other than "unsigned char".)

If adding
#undef u_char
just above the typedef avoids the error message, then that's your
problem. (This is a diagnostic, not a solution.)

Look for other occurrences of "u_char" in your header files. Try
commenting out other "#include" directives preceding the one for the
header containing the typedef; if that avoids the problem, the header
you commented out is probably the one causing it.

Finally, if you find a header that declares u_char as a macro rather
than as a typedef, complain bitterly to whomever is responsible for
that header. Using a macro rather than a typedef for something like
this is a bad idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top