tech:unix:freebsd:uint
This is an old revision of the document!
Table of Contents
Use of undeclared identifier 'uint' when compiling in clang / gcc
Environment
- FreeBSD
- clang / gcc
Symptom
When attempting to compile a C program (probably one you downloaded from the internet), in either clang
or gcc
, you encounter an error similar to this one:
myprogram.c:600:2: error: use of undeclared identifier 'uint'; did you mean 'int'? uint n=0; ^~~~ int
Root Cause
uint
is not a standard C data type, however it is used by other platforms, such as Linux.
Solution
To resolve this issue, declare the uint
type before main
in the C source file, for example:
typedef __uint32_t uint;
The program should then compile.
tech/unix/freebsd/uint.1716305599.txt.gz · Last modified: 2024/05/21 15:33 by puisor