Reputation: 103
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 ...
Upvotes: 4
Views: 3718
Reputation: 11841
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.
Upvotes: 2
Reputation: 153840
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 typedef
s do the right thing, needs to be verified, though.
Upvotes: 4