tech:unix:freebsd:uint
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, 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, so it must be declared.
Solution
Include the sys/types.h
header file before main
in the C source file:
#include <sys/types.h>
The program should then compile.
tech/unix/freebsd/uint.txt · Last modified: 2024/05/22 08:07 by puisor