未知的types名称“uint8_t”,MinGW
我得到“未知的types名称”uint8_t“”和其他人喜欢它在MinGW中使用C. 任何想法如何解决这个问题?
尝试包括stdint.h或inttypes.h 。
要使用uint8_ttypes的别名,你必须包含stdint.h标准头。
你需要#include stdint.h之前#include任何其他需要它的库接口。
例:
我的LCD库使用uint8_ttypes。 我写了一个接口( Display.h )和一个实现( Display.c )
在display.c中,我有以下内容。
#include <stdint.h> #include <string.h> #include <avr/io.h> #include <Display.h> #include <GlobalTime.h>
这工作。
但是,如果我重新安排他们这样的:
#include <string.h> #include <avr/io.h> #include <Display.h> #include <GlobalTime.h> #include <stdint.h>
我得到你描述的错误。 这是因为Display.h需要stdint.h东西,但不能访问它,因为在编译Display.h之后编译了这些信息。
所以把stdint.h放在任何需要它的库之上,你不应该stdint.h这个错误了。