如何修复 GCC 错误:unknown type name 'size_t' (STM32)
问题:
尝试编译 C/C++ 项目(通常是 STM32 项目)时:
compile_error_output.txt
C:/Users/User/MyProject/MyHeader.h:9:7: error: unknown type name 'size_t'
9 | const size_t MySize = 15;
| ^~~~~~解决方案
在错误发生的文件顶部,添加以下行:
include_stddef.h
#include <stddef.h>Check out similar posts by category:
C/C++, GCC Errors, STM32
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow