Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
rt_thread_creadt
新建动态线程出现如下问题
发布于 2020-12-10 14:58:51 浏览:1411
订阅该版
#include
#include"gpio.h" #define DBG_TAG "main" #define DBG_LVL DBG_LOG #include
#define THREAD_PRIORITY 25 #define THREAD_STACK_SIZE 512 #define THREAD_TIMESLICE 5 static rt_thread_t tid1 = RT_NULL; /* 线程1的入口函数 */ static void thread1_entry(void *parameter) { while(1) { LED1_ON; rt_thread_mdelay(1000); LED1_OFF; rt_thread_mdelay(1000); } } ALIGN(RT_ALIGN_SIZE) static char thread2_stack[1024]; static struct rt_thread thread2; /* 线程2的入口函数 */ static void thread2_entry(void *parameter) { while(1) { LED2_ON; rt_thread_mdelay(500); LED2_OFF; rt_thread_mdelay(500); } } int thread_sample(void) { tid1 = rt_thread_create("thread1", thread1_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); if(tid1 != RT_NULL) rt_thread_startup(tid1); /* 初始化线程2, 名称是thread2, 入口是thread2_entry */ rt_thread_init(&thread2, "thread2", thread2_entry, RT_NULL, &thread2_stack[0], sizeof(thread2_stack), THREAD_PRIORITY-1, THREAD_TIMESLICE); rt_thread_startup(&thread2); return 0; } int main(void) { // int count = 1; MX_GPIO_Init(); thread_sample(); // while (count++) // { // LOG_D("Hello RT-Thread!"); // rt_thread_mdelay(1000); // } return RT_EOK; } 编译时报错:arm-none-eabi-gcc "../applications/main.c" linking... ./applications/main.o: In function `thread_sample': D:\RT-ThreadStudio\workspace\Test\Debug/../applications/main.c:53: undefined reference to `rt_thread_create' collect2.exe: error: ld returned 1 exit status make: *** [makefile:53: rtthread.elf] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete. 14:57:01 Build Failed. 2 errors, 0 warnings. (took 491ms)
查看更多
2
个回答
默认排序
按发布时间排序
张世争
2020-12-10
学以致用
全局搜索一下: rt_thread_create,为什么找不到定义?
WQ炑
2021-03-08
这家伙很懒,什么也没写!
在RT-Thread studio中,打开RT-Thread Setting,然后找到内核里面的内存管理,有个使能动态内存,使能一下,再次编译就可以了
撰写答案
登录
注册新账号
关注者
0
被浏览
1.4k
关于作者
suwenli401
这家伙很懒,什么也没写!
提问
1
回答
0
被采纳
0
关注TA
发私信
相关问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
CherryUSB STM32 glue 新增初始化
2
在LPC1114上移植 RT-Thread Nano 3.1.5
3
求助can通讯下怎末运用485
4
STM32F407ZGT适配串口V2驱动
5
【CFP】2025 RT-Thread全球技术大会演讲征集开始啦!
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
cubemx
ESP8266
WIZnet_W5500
UART
BSP
ota在线升级
PWM
flash
packages_软件包
freemodbus
潘多拉开发板_Pandora
ADC
GD32
定时器
flashDB
编译报错
keil_MDK
socket
中断
rt_mq_消息队列_msg_queue
Debug
ulog
SFUD
msh
C++_cpp
at_device
本月问答贡献
聚散无由
9
个答案
6
次被采纳
RTT_逍遥
10
个答案
2
次被采纳
a1012112796
5
个答案
2
次被采纳
三世执戟
4
个答案
2
次被采纳
加缪
2
个答案
2
次被采纳
本月文章贡献
wake_mirco
2
篇文章
7
次点赞
mushroom
1
篇文章
9
次点赞
张世争
1
篇文章
7
次点赞
RTT_逍遥
1
篇文章
6
次点赞
Jack_____
1
篇文章
5
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部