原先工程配置C/C++ Define定义芯片型号是STM32G070xx,后修改成STM32G030xx,结果编译后仍然是stm32g070xx.h头文件生效,而不是stm32g030xx.h #if defined(STM32G071xx) #include "stm32g071xx.h" #elif defined(STM32G081xx) #include "stm32g081xx.h" #elif defined(STM32G070xx) #include "stm32g070xx.h" #elif defined(STM32G031xx) #include "stm32g031xx.h" #elif defined(STM32G041xx) #include "stm32g041xx.h" #elif defined(STM32G030xx) #include "stm32g030xx.h" #else #error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)" #endif 有人遇到过吗?求解答!!!!!!!! |
多检查下,是不是写错了
您的定义在哪呢?会不会是定义没有同步修改? 建议您不要用那么多的判断来包含,删除其余的包含判断试试。
楼主看一下工程配置中的C/C++选项,Define这一项中的预定义。
楼主看一下工程配置中的C/C++选项,Define这一项中的预定义。
我这里是KEIL的查看方法,其他工具类似,可能在其他的地方。
问题已找到,在keil工程配置里Device选项选的是STM32G070型号,在C/C++选项Define预定义里STM32G070xx改成STM32G030xx是无法生效的,还得在Device选项选STM32G030型号