kingsabbit 发表于 2014-11-12 23:10:00

IAR 编译出错“declaration is incompatible with ”的解决方法

本帖最后由 kingsabbit 于 2014-11-12 23:11 编辑

安装新版本后,IAR库和STM32库不兼容,会导致编译时出现“declaration is incompatible with ”等一堆错误,如下:

Building configuration: app - Debug
Updating build tree...
at24c16.c
Error: declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_PSP(void)" (declared at line 52 of "C:\Program FilesC:\Users\Administrator.EOEWQ4H5V1I17GH\Desktop\W5500_HTTPS\W5500_HTTPS\source\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h 1086
(x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\c\intrinsics.h")
Error: declaration is incompatible with "__nounwind __interwork __softfp void __set_PSP(unsigned long)" (declared at line 53 of "C:\Program FilesC:\Users\Administrator.EOEWQ4H5V1I17GH\Desktop\W5500_HTTPS\W5500_HTTPS\source\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h 1096
(x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\c\intrinsics.h")
Error: declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_MSP(void)" (declared at line 50 of "C:\Program FilesC:\Users\Administrator.EOEWQ4H5V1I17GH\Desktop\W5500_HTTPS\W5500_HTTPS\source\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h 1106
(x86)\IAR Systems\Embedded Workbench 7.0\arm\inc\c\intrinsics.h")

此处省备N多错误

Error while running C/C++ Compiler

Total number of errors: 180
Total number of warnings: 0

此种问题的解决方法:

把core_cm3.h里面这句给注释掉,然后加上一句
#if defined (__ICCARM__)
//#include <intrinsics.h>                     /* IAR Intrinsics   */
__intrinsic void __DSB(void);
#endif
完全没有任何警告和错误。

eovlon 发表于 2017-12-26 23:46:42

兄台如何发现要加这句话的?

kingsabbit 发表于 2018-1-15 00:29:41

eovlon 发表于 2017-12-26 23:46
兄台如何发现要加这句话的?

遇到个这个问题,研究了很久才找到答案{:lol:}
页: [1]
查看完整版本: IAR 编译出错“declaration is incompatible with ”的解决方法