stm32的hall库新建模板编译错误: #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)"的处理

在stm32f1xx.h file文件中找到如下代码:

/* Uncomment the line below according to the target STM32L device used in your
   application
  */

#if !defined (STM32F100xB) && !defined (STM32F100xE) && !defined (STM32F101x6) && \
    !defined (STM32F101xB) && !defined (STM32F101xE) && !defined (STM32F101xG) && !defined (STM32F102x6) && !defined (STM32F102xB) && !defined (STM32F103x6) && \
    !defined (STM32F103xB) && !defined (STM32F103xE) && !defined (STM32F103xG) && !defined (STM32F105xC) && !defined (STM32F107xC)
  /* #define STM32F100xB  */   /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */
  /* #define STM32F100xE */    /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */
  /* #define STM32F101x6  */   /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */
  /* #define STM32F101xB  */   /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */
  /* #define STM32F101xE */    /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */
  /* #define STM32F101xG  */   /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */
  /* #define STM32F102x6  */  /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */
  /* #define STM32F102xB  */   /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */
  /*#define STM32F103x6   */  /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */
  /* #define STM32F103xB  */   /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */
  /* #define STM32F103xE */    /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */
  /* #define STM32F103xG  */   /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */
  /* #define STM32F105xC */    /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */
  /* #define STM32F107xC  */   /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */  
#endif

然后找到你用的MCU去掉其前后的注释即可!

原文地址:https://www.cnblogs.com/micro-st/p/8886566.html

时间: 2024-12-28 22:02:06

stm32的hall库新建模板编译错误: #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)"的处理的相关文章

keil编译STM32工程时 #error directive: &quot;Please select first the target STM32F10x device used in your application (in stm32f10x.h file)&quot;

我们可以双击错误,然后会自动定位到文件 stm32f10x.h 中出错的地方,可以看到代码: #if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined(STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD)&& !defined (STM32F10X_HD_VL

jni 编译错误error: unknown type name &#39;__va_list&#39;

platforms\android-9\arch-arm\usr\include\stdio.h:257:37: error: unknown type name '__va_list' 解决方法: 默认的android-9不兼容 Applicaton.mk  添加APP_PLATFORM := android-21 jni 编译错误error: unknown type name '__va_list'

Thrift-0.10.0 CenOS 7 编译错误 error: expected &#39;)&#39; before &#39;PRIu32&#39;

Thrift-0.10.0 CenOS 7 编译错误 error: expected ')' before 'PRIu32' 在编译Thrift的时候,无论是Apache官网tar包,还是Github镜像,都会出现各种错误,其中一个比较头疼的就是标题描述的编译错误,经过捣鼓,终于妥协性的搞定了. make时的错误描述: src/thrift/server/TNonblockingServer.cpp: In member function 'void apache::thrift::server

android 编译错误 Error:(1, 0) Plugin with id &#39;com.android.application&#39; not found.

在导入一个项目时,由于它本身的gradle版本比较高,你试用比较旧版本的gradle时就报出Plugin with id 'com.android.application' not found.的错误 如果出现如上错误,只需要在build.gradle中添加下面代码即可: (直接加在 android{ } 的外面) buildscript { repositories { jcenter() // or mavenCentral() } dependencies { classpath 'com

boost库之pool编译错误

1,编译错误截图 2,解决方法 这是由于没有链接对应的库导致的错误,在编译命令中加上 -lboost_system选项即可.

bullet, iOS真机编译错误error: identifier or immediate expression expected解决方法

刚才发现c3dEngine2(http://git.oschina.net/wantnon2/c3dEngine2 或 https://github.com/wantnon2/c3dEngine2)的bulletTest1 demo在iOS真机上编译不过,报error: identifier or immediate expression expected的编译错误. google了一下,找到下面帖子:http://www.bulletphysics.org/Bullet/phpBB3/view

Cocos2d-x新建模板编译问题总汇

0:关于使用VC模板创建模板时候脚本错误.改动..\cocos2d-x-2.2.2\template\msvc\CCAppWiz.win32\HTML\1033中文件属性中:安全->解除锁定. 1:fatal error C1083: 无法打开包含文件:"cocos2d.h": No such file or directory 缺失这些头文件 原因是cocos2d-x在编译时用的是自身文件夹 假设我们的project建立在cocos2d-x的文件夹里 就不会有这种问题  可是我

VC++编译错误error C2065: “HANDLE”: 未声明的标识符及添加winbase.h后提示winbase.h(243): error C2146: 语法错误: 缺少“;”(在标识符“Internal”的前面)的解决办法

问题描述: VC++程序编译时提示错误:error C2065: "HANDLE": 未声明的标识符等众多错误提示,如下所示: error C2065: "HANDLE": 未声明的标识符 error C2146: 语法错误: 缺少";"(在标识符"hFind"的前面) error C2065: "hFind": 未声明的标识符 error C2065: "INVALID_HANDLE_VALUE

编译错误 error C2451: “std::_Unforced”类型的条件表达式是非法的

part 1 编译器 vs2015 VC++. 完整的错误信息粘贴如下: d:\program files (x86)\microsoft visual studio 14.0\vc\include\algorithm(43): error C2451: “std::_Unforced”类型的条件表达式是非法的 完整代码: struct Bigger { bool operator() (vector<string>::size_type lhs, vector<string>::