I have a project source code

it contain uchar_t

I need to compile this project in Ubuntu 13.10 but when run compilation that it warn :

unknown type name ‘uchar_t’ 

anyone have idea to solve. replace uchar_t or other solution ...

1

3 Answers

It seems, uchar_t is meant to represent some character in which case you probably want to make it an unsigned character type, e.g.:

typedef unsigned char uchar_t; 

Whether this works depends on what the code really intended to do. Without context it is impossible to tell what is intended. In either case, I would use a typedef in a strategic place rather than replacing the type. Likewise, uint_t is probably meant to be

typedef unsigned int uint_t; 

Whether these typedefs do the right thing, needs to be verified, though.

9

That is probably an alias for unsigned char.

The types uchar_t, ushort_t, uint_t and ulong_t are Solaris specific types defined in sys/types.h and commented as POSIX Extensions. That comment is ambiguous and probably means that they are (vendor specific) extensions to the POSIX standard, not that they're part of it. Some other systems define them, others not (cygwin, Linux). They are quite straight-forward and can be quickly replaced by adding

typedef unsigned char uchar_t; typedef unsigned short ushort_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; 

somewhere in the project's headers. I like them a lot because they are shorter, 1 word, follow the POSIX and the inttypes.h naming style and are quite obvious.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy