打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
用stm32f10x.h文件时的问题error: #35: #error directive: “Please select first the target STM32F10x

    在用uvison4.x(MDK4.x)建立一个开发STM32F103的工程:test.uvproj
在工程中加入源程序main.c文件,源代码内容如下:
#include "stm32f10x.h"
int main(void)
{
  return 0;

}
编译会出现错误,使得入门者难以继续深入学习STM32。
错误提示的全部信息如下:
C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h(80):error:  #35: #error directive: "Please selectfirst the target STM32F10x device used in your application (instm32f10x.h file)"
解决办法如下:
   右键点击工程名,选择第一个options for target ,下面选择C/C++,在define文本框中输入:
STM32F10X_MD,USE_STDPERIPH_DRIVER即可。MD根据你选择的机种更换为LD或HD


   再编译,会出现更多错误,例如: error:  #256: invalid redeclaration of type name "s32" (declared at line 470 of "C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h") #256: invalid redeclaration of type name "sc32" (declared at line 474 of "C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h")...... error:  #101: "RESET" has already been declared in the current scopeerror:  #101: "SET" has already been declared in the current scope......error:  #256: invalid redeclaration of type name "ErrorStatus" (declared at line 507 of "C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h")warning:  #47-D: incompatible redefinition of macro "HSE_Value" (declared at line 511 of "C:\Keil_STM32\ARM\INC\ST\STM32F10x\stm32f10x.h")   解决办法:打开stm32f10x_conf.h文件,将第21行的“#include "stm32f10x_type.h"”注释掉,再保存stm32f10x_conf.h文件,重新编译即可。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
使用keil编译软件的常见错误
RL-ARM User's Guide
STM3210x库文件在Keil MDK环境下的使用
MDK与git一起使用管理嵌入式软件项目
stm32 开发环境MDK+库文件配置-Changing's Blog
Keil(MDK
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服