找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 21536|回复: 1
打印 上一主题 下一主题
收起左侧

error: #35: #error directive: "Please select first the target STM32F10x

[复制链接]
跳转到指定楼层
楼主
ID:85109 发表于 2015-7-8 22:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用stm32f10x.h文件时的问题
    在用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文件,重新编译即可。


评分

参与人数 1黑币 +15 收起 理由
王朗的诱惑 + 15 很给力!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:134810 发表于 2017-9-16 11:42 | 只看该作者
谢谢分享
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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