Keil5报错:Error:L6218E:Undefined symbol rt_thread_create(referred from main.o)
Keil5报错:Error:L6218E:Undefined symbol rt_thread_create(referred from main.o)
·
项目场景:
STM32CubeMX 生成带有 RT-Thread Nano 的工程
问题描述
在 main 函数中调用函数 rt_thread_create(…),编译时发生报错:


原因分析:
🔅函数 rt_thread_create(…) 创建线程是采用动态分配的方式,内核对象从内存堆中创建;
通过查阅官方文档得知:
⭐内存堆功能是否使用取决于宏 RT_USING_HEAP 是否开启,RT-Thread Nano 默认不开启内存堆功能;

解决方案:
1️⃣打开头文件 "rtconfig.h";
2️⃣找到行 "#define RT_USING_HEAP",取消注释,重新编译即可;
更多推荐
所有评论(0)