Page 1 of 1

error: unknown type name uint8_t

Posted: Tue Nov 01, 2016 7:03 am
by dotaviper
Create two new files key.c and key.h and add them to my project.
step1: defined a global variable in key.c: uint8_t PHOTO_COUNT = 0;
step2: extern it in key.h:extern uint8_t PHOTO_COUNT;
step3:add #include "key.h" in key.c and main.c
step4: add key.c in makefile.

Code: Select all

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(STARTUPSRC) \
       $(KERNSRC) \
       $(PORTSRC) \
       $(OSALSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
       $(TESTSRC) \
       main.c  \
       key.c  \
 

step5: use the variable in main.c: PHOTO_COUNT=1;
after building,there are 2 eerors:
key.h:19:1: error: unknown type name 'uint8_t'
key.c:31:9: error: conflicting types for 'PHOTO_COUNT'
expected your answers,thank you .

Re: error: unknown type name uint8_t

Posted: Tue Nov 01, 2016 7:37 am
by Giovanni
You need to include stdint.h.

Giovanni