OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 13486|回复: 3

使用函数库 编译时遇到了问题

[复制链接]

12

主题

21

帖子

0

精华

初级会员

Rank: 2

积分
89
金钱
89
注册时间
2012-3-8
在线时间
0 小时
发表于 2012-3-16 11:22:59 | 显示全部楼层 |阅读模式
使用3.5版本的函数库,在开头包含头文件#include "stm32f10x_lib.h",一编译却出现了一大堆的lib中系统自带的库函数的错误,都是说无效的重定义的错误,
.\lib\CMSIS\CM3\CoreSupport\core_cm3.h(725): warning:  #47-D: incompatible redefinition of macro "NVIC" (declared at line 934 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(487): error:  #256: invalid redeclaration of type name "s32" (declared at line 23 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(491): error:  #256: invalid redeclaration of type name "sc32" (declared at line 27 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(495): error:  #256: invalid redeclaration of type name "vs32" (declared at line 31 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(499): error:  #256: invalid redeclaration of type name "vsc32" (declared at line 35 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(503): error:  #256: invalid redeclaration of type name "u32" (declared at line 39 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(507): error:  #256: invalid redeclaration of type name "uc32" (declared at line 43 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(511): error:  #256: invalid redeclaration of type name "vu32" (declared at line 47 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(515): error:  #256: invalid redeclaration of type name "vuc32" (declared at line 51 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(519): error:  #101: "RESET" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(519): error:  #101: "SET" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(519): error:  #256: invalid redeclaration of type name "FlagStatus" (declared at line 57 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(519): error:  #256: invalid redeclaration of type name "ITStatus" (declared at line 57 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(521): error:  #101: "DISABLE" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(521): error:  #101: "ENABLE" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(521): error:  #256: invalid redeclaration of type name "FunctionalState" (declared at line 59 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(524): error:  #101: "ERROR" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(524): error:  #101: "SUCCESS" has already been declared in the current scope
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(524): error:  #256: invalid redeclaration of type name "ErrorStatus" (declared at line 62 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_type.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(528): warning:  #47-D: incompatible redefinition of macro "HSE_Value" (declared at line 147 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_conf.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(564): error:  #256: invalid redeclaration of type name "ADC_TypeDef" (declared at line 58 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(663): error:  #256: invalid redeclaration of type name "BKP_TypeDef" (declared at line 154 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(675): error:  #256: invalid redeclaration of type name "CAN_TxMailBox_TypeDef" (declared at line 163 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(687): error:  #256: invalid redeclaration of type name "CAN_FIFOMailBox_TypeDef" (declared at line 171 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(697): error:  #256: invalid redeclaration of type name "CAN_FilterRegister_TypeDef" (declared at line 177 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(731): error:  #256: invalid redeclaration of type name "CAN_TypeDef" (declared at line 203 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(758): error:  #256: invalid redeclaration of type name "CRC_TypeDef" (declared at line 213 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(782): error:  #256: invalid redeclaration of type name "DAC_TypeDef" (declared at line 232 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(792): error:  #256: invalid redeclaration of type name "DBGMCU_TypeDef" (declared at line 239 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(804): error:  #256: invalid redeclaration of type name "DMA_Channel_TypeDef" (declared at line 248 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(810): error:  #256: invalid redeclaration of type name "DMA_TypeDef" (declared at line 254 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
.\lib\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(895): error:  #256: invalid redeclaration of type name "EXTI_TypeDef" (declared at line 265 of "D:\ARM??\keil4\ARM\INC\ST\STM32F10x\stm32f10x_map.h")
然后我又将这个包含的头文件改为#include "STM32F10X.H",结果一编译出现了
user\main.c(74): error:  #20: identifier "RCC_PLLSource_HSE_Div1" is undefined
这个错误是怎么回事?到底应该包含哪个头文件,这两个头文件有啥不同??
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2012-3-16 12:06:56 | 显示全部楼层
参考一下库函数的例子,你看看哪些地方不一致吧.
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

36

主题

1105

帖子

5

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
2201
金钱
2201
注册时间
2012-2-8
在线时间
35 小时
发表于 2012-3-16 13:13:49 | 显示全部楼层
3.5 版的库已经不需要#include "stm32f10x_lib.h"了。。。

一大堆错误没什么的,看第一个就行了,
https://github.com/roxma
回复 支持 反对

使用道具 举报

4

主题

25

帖子

0

精华

初级会员

Rank: 2

积分
61
金钱
61
注册时间
2012-9-5
在线时间
0 小时
发表于 2013-1-11 11:25:26 | 显示全部楼层
回复【3楼】Pony279:
3.5 版的库已经不需要#include "stm32f10x_lib.h"了。。。 一大堆错误没什么的,看第一个就行了,
---------------------------------
果然,就是#include "stm32f10x_lib.h"的问题,去掉就不报错了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-21 11:56

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表