这是因为你在stm8s.h里没有加入宏定义或宏定义不是你的器件,
在stm8s.h里有这样几行,
#if !defined (STM8S208) !defined (STM8S207) !defined (STM8S105) !defined (STM8S103) !defined (STM8S903) !defined (STM8AF52Ax) !defined (STM8AF62Ax) !defined (STM8AF626x)
#error "Please select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif
在你编译时,如果没有以上宏定义,就会报这个错。
在stm8s.h里有一段选择器件的代码:
// #define STM8S207 /*!< STM8S High density devices without CAN */
/* #define STM8AF52Ax */ /*!< STM8A High density devices with CAN */
/* #define STM8AF62Ax */ /*!< STM8A High density devices without CAN */
/* #define STM8S105 */ /*!< STM8S Medium density devices */
/* #define STM8AF626x */ /*!< STM8A Medium density devices */
/* #define STM8S903 */ /*!< STM8S Low density devices */
你选的器件是STM8S Low density devices ,所以可以 把/* #define STM8S903 */的注释符去掉,或者自己定义 #define STM8S003
这是因为你在stm8s.h里没有加入宏定义或宏定义不是你的器件,
在stm8s.h里有这样几行,
#if !defined (STM8S208) !defined (STM8S207) !defined (STM8S105) !defined (STM8S103) !defined (STM8S903) !defined (STM8AF52Ax) !defined (STM8AF62Ax) !defined (STM8AF626x)
#error "Please select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif
在你编译时,如果没有以上宏定义,就会报这个错。
在stm8s.h里有一段选择器件的代码:
// #define STM8S207 /*!< STM8S High density devices without CAN */
/* #define STM8AF52Ax */ /*!< STM8A High density devices with CAN */
/* #define STM8AF62Ax */ /*!< STM8A High density devices without CAN */
/* #define STM8S105 */ /*!< STM8S Medium density devices */
/* #define STM8AF626x */ /*!< STM8A Medium density devices */
/* #define STM8S903 */ /*!< STM8S Low density devices */
你选的器件是STM8S Low density devices ,所以可以 把/* #define STM8S903 */的注释符去掉,或者自己定义 #define STM8S003
举报