Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
RT-Thread一般讨论
搭建最小工程时编译出错
发布于 2018-06-19 22:04:08 浏览:6633
订阅该版
按照教程“Keil下搭建RT-Thread最小工程”时编译出错,信息如下: *** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'rt-thread' compiling stm32f1xx_hal.c... compiling stm32f1xx_hal_adc.c... compiling stm32f1xx_hal_adc_ex.c... compiling stm32f1xx_hal_can.c... compiling stm32f1xx_hal_cec.c... compiling stm32f1xx_hal_cortex.c... compiling stm32f1xx_hal_crc.c... compiling stm32f1xx_hal_dac.c... compiling stm32f1xx_hal_dac_ex.c... compiling stm32f1xx_hal_dma.c... compiling stm32f1xx_hal_eth.c... compiling stm32f1xx_hal_flash.c... compiling stm32f1xx_hal_flash_ex.c... compiling stm32f1xx_hal_gpio.c... compiling stm32f1xx_hal_gpio_ex.c... compiling stm32f1xx_hal_hcd.c... compiling stm32f1xx_hal_i2c.c... compiling stm32f1xx_hal_i2s.c... compiling stm32f1xx_hal_irda.c... compiling stm32f1xx_hal_iwdg.c... compiling stm32f1xx_hal_mmc.c... compiling stm32f1xx_hal_msp_template.c... compiling stm32f1xx_hal_nand.c... compiling stm32f1xx_hal_nor.c... compiling stm32f1xx_hal_pccard.c... compiling stm32f1xx_hal_pcd.c... compiling stm32f1xx_hal_pcd_ex.c... compiling stm32f1xx_hal_pwr.c... compiling stm32f1xx_hal_rcc.c... compiling stm32f1xx_hal_rcc_ex.c... Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c(134): error: #268: declaration may not appear after executable statement in block FlagStatus pwrclkchanged = RESET; Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c: 0 warnings, 1 error compiling stm32f1xx_hal_rtc.c... compiling stm32f1xx_hal_rtc_ex.c... compiling stm32f1xx_hal_sd.c... compiling stm32f1xx_hal_smartcard.c... compiling stm32f1xx_hal_spi.c... compiling stm32f1xx_hal_spi_ex.c... compiling stm32f1xx_hal_sram.c... compiling stm32f1xx_hal_tim.c... compiling stm32f1xx_hal_tim_ex.c... compiling stm32f1xx_hal_timebase_rtc_alarm_template.c... Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(90): error: #20: identifier "RTC_HandleTypeDef" is undefined RTC_HandleTypeDef hRTC_Handle; Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(144): error: #20: identifier "RTC_OUTPUTSOURCE_NONE" is undefined hRTC_Handle.Init.OutPut = RTC_OUTPUTSOURCE_NONE; Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(145): warning: #223-D: function "HAL_RTC_Init" declared implicitly HAL_RTC_Init(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(148): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_DISABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_DISABLE(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(151): warning: #223-D: function "__HAL_RTC_ALARM_CLEAR_FLAG" declared implicitly __HAL_RTC_ALARM_CLEAR_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(151): error: #20: identifier "RTC_FLAG_ALRAF" is undefined __HAL_RTC_ALARM_CLEAR_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(155): warning: #223-D: function "__HAL_RTC_ALARM_GET_FLAG" declared implicitly while(__HAL_RTC_ALARM_GET_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF) != RESET) Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(169): warning: #223-D: function "__HAL_RTC_ALARM_EXTI_ENABLE_IT" declared implicitly __HAL_RTC_ALARM_EXTI_ENABLE_IT(); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(170): warning: #223-D: function "__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE" declared implicitly __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(173): error: #20: identifier "RTC_FLAG_SEC" is undefined LEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(173): error: #20: identifier "RTC_FLAG_OW" is undefined LEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(181): warning: #223-D: function "__HAL_RTC_ALARM_ENABLE_IT" declared implicitly __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(181): error: #20: identifier "RTC_IT_ALRA" is undefined __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(184): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_ENABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_ENABLE(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(213): warning: #223-D: function "__HAL_RTC_ALARM_DISABLE_IT" declared implicitly __HAL_RTC_ALARM_DISABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(213): error: #20: identifier "RTC_IT_ALRA" is undefined __HAL_RTC_ALARM_DISABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(227): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_DISABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_DISABLE(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(235): error: #20: identifier "RTC_FLAG_SEC" is undefined LEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(235): error: #20: identifier "RTC_FLAG_OW" is undefined LEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(235): error: #20: identifier "RTC_FLAG_ALRAF" is undefined LEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(238): warning: #223-D: function "__HAL_RTC_ALARM_ENABLE_IT" declared implicitly __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(238): error: #20: identifier "RTC_IT_ALRA" is undefined __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(241): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_ENABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_ENABLE(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(261): error: #20: identifier "RTC_HandleTypeDef" is undefined void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(267): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_DISABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(275): error: #20: identifier "RTC_FLAG_SEC" is undefined LEAR_BIT(hrtc->Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(275): error: #20: identifier "RTC_FLAG_OW" is undefined LEAR_BIT(hrtc->Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(278): warning: #223-D: function "__HAL_RTC_WRITEPROTECTION_ENABLE" declared implicitly __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c(296): warning: #223-D: function "HAL_RTC_AlarmIRQHandler" declared implicitly HAL_RTC_AlarmIRQHandler(&hRTC_Handle); Libraries\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_timebase_rtc_alarm_template.c: 15 warnings, 14 errors compiling stm32f1xx_hal_timebase_tim_template.c... compiling stm32f1xx_hal_uart.c... compiling stm32f1xx_hal_usart.c... compiling stm32f1xx_hal_wwdg.c... compiling stm32f1xx_ll_adc.c... compiling stm32f1xx_ll_crc.c... compiling stm32f1xx_ll_dac.c... compiling stm32f1xx_ll_dma.c... compiling stm32f1xx_ll_exti.c... compiling stm32f1xx_ll_fsmc.c... compiling stm32f1xx_ll_gpio.c... compiling stm32f1xx_ll_i2c.c... compiling stm32f1xx_ll_pwr.c... compiling stm32f1xx_ll_rcc.c... compiling stm32f1xx_ll_rtc.c... compiling stm32f1xx_ll_sdmmc.c... compiling stm32f1xx_ll_spi.c... compiling stm32f1xx_ll_tim.c... compiling stm32f1xx_ll_usart.c... compiling stm32f1xx_ll_usb.c... compiling stm32f1xx_ll_utils.c... compiling system_stm32f1xx.c... assembling startup_stm32f103xe.s... ".\Objects\project.axf" - 15 Error(s), 15 Warning(s). Target not created. Build Time Elapsed: 00:01:59 各位大神帮忙看一下问题出在哪里,谢谢!!! ![固件库.jpg](https://oss-club.rt-thread.org/uploads/201806/19/220033k1tgjtg1ytkyljjs.jpg) ![keil版本.jpg](https://oss-club.rt-thread.org/uploads/201806/19/220034kksuqv8vts0xxzx0.jpg) ![教程是否出错.jpg](https://oss-club.rt-thread.org/uploads/201806/19/220305wl9d0snendsinxf0.jpg)
查看更多
7
个回答
默认排序
按发布时间排序
tanek
2018-06-19
这家伙很懒,什么也没写!
这个是STM32的库里面的宏,你大概是没有把RTC相关的头文件包含进来。
敬坚
2018-06-20
这家伙很懒,什么也没写!
>这个是STM32的库里面的宏,你大概是没有把RTC相关的头文件包含进来。 --- 我是有添加头文件路径的,而且在文件夹中也能看到rtc相关的头文件。还有我尝试在项目中直接添加头文件也没能编译通过。
敬坚
2018-06-20
这家伙很懒,什么也没写!
>我是有添加头文件路径的,而且在文件夹中也能看到rtc相关的头文件。还有我尝试在项目中直接添加头文件也 ... --- RTC头文件未包含是因为官方固件库配置文件里没有打开RTC模块,修改后宏定义错误就没有了。但还有一个问题没找出原因请看图片
tanek
2018-06-20
这家伙很懒,什么也没写!
>RTC头文件未包含是因为官方固件库配置文件里没有打开RTC模块,修改后宏定义错误就没有了。但还有一个问题 ... --- 需要打开C99
yaomo718
2018-06-20
这家伙很懒,什么也没写!
>RTC头文件未包含是因为官方固件库配置文件里没有打开RTC模块,修改后宏定义错误就没有了。但还有一个问题 ... --- 你这个错误确实如5楼所说的,需要勾选 C99 mode。这个错误解决以后你应该还会遇到下面的错误提示吧? ``` linking... .\build\rtthread-stm32.axf: Error: L6200E: Symbol HAL_MspInit multiply defined (by stm32f1xx_hal_msp_template.o and board.o). .\build\rtthread-stm32.axf: Error: L6200E: Symbol HAL_InitTick multiply defined (by stm32f1xx_hal_timebase_tim_template.o and stm32f1xx_hal_timebase_rtc_alarm_template.o). .\build\rtthread-stm32.axf: Error: L6200E: Symbol HAL_SuspendTick multiply defined (by stm32f1xx_hal_timebase_tim_template.o and stm32f1xx_hal_timebase_rtc_alarm_template.o). .\build\rtthread-stm32.axf: Error: L6200E: Symbol HAL_ResumeTick multiply defined (by stm32f1xx_hal_timebase_tim_template.o and stm32f1xx_hal_timebase_rtc_alarm_template.o). Not enough information to list image symbols. Not enough information to list the image map. Finished: 2 information, 0 warning and 4 error messages. ".\build\rtthread-stm32.axf" - 4 Error(s), 2 Warning(s). Target not created. Build Time Elapsed: 00:00:43 ``` 这是因为函数重复定义了,我们使用rt-thread里提供的函数,所以把stm32f1xx_hal_msp_template.c,stm32f1xx_hal_timebase_tim_template.c,stm32f1xx_hal_timebase_rtc_alarm_template.c这三个文件从工程里移除就可以了。
敬坚
2018-06-20
这家伙很懒,什么也没写!
>你这个错误确实如5楼所说的,需要勾选 C99 mode。这个错误解决以后你应该还会遇到下面的错误提示吧? > >这 ... --- 真的是,刚还在想怎么弄,谢谢阿!!!
敬坚
2018-06-20
这家伙很懒,什么也没写!
>需要打开C99 --- 谢谢!!!
撰写答案
登录
注册新账号
关注者
0
被浏览
6.6k
关于作者
敬坚
这家伙很懒,什么也没写!
提问
11
回答
14
被采纳
0
关注TA
发私信
相关问题
1
有关动态模块加载的一篇论文
2
最近的调程序总结
3
晕掉了,这么久都不见layer2的踪影啊
4
继续K9ii的历程
5
[GUI相关] FreeType 2
6
[GUI相关]嵌入式系统中文输入法的设计
7
20081101 RT-Thread开发者聚会总结
8
嵌入式系统基础
9
linux2.4.19在at91rm9200 上的寄存器设置
10
[转]基于嵌入式Linux的通用触摸屏校准程序
推荐文章
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
在用clangd开发RTT吗,快来试试如何简单获得清晰干净的工作区
2
GD32F450 片内 flash驱动适配
3
STM32H7R7运行CherryUSB
4
RT-Smart首次线下培训,锁定2024 RT-Thread开发者大会!
5
使用RC522软件包驱动FM1722
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
UART
WIZnet_W5500
ota在线升级
PWM
freemodbus
flash
cubemx
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
中断
编译报错
Debug
SFUD
rt_mq_消息队列_msg_queue
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
a1012112796
10
个答案
1
次被采纳
踩姑娘的小蘑菇
4
个答案
1
次被采纳
红枫
4
个答案
1
次被采纳
张世争
4
个答案
1
次被采纳
Ryan_CW
4
个答案
1
次被采纳
本月文章贡献
catcatbing
3
篇文章
6
次点赞
YZRD
2
篇文章
5
次点赞
qq1078249029
2
篇文章
2
次点赞
xnosky
2
篇文章
1
次点赞
Woshizhapuren
1
篇文章
5
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部