中科因仑“3+1”工程特种兵精英论坛

标题: IAR 编译出错“declaration is incompatible with ”的解决方法 [打印本页]

作者: liliuyang    时间: 2016-4-1 18:07
标题: IAR 编译出错“declaration is incompatible with ”的解决方法
安装新版本后,IAR库和STM32库不兼容,会导致编译时出现“declaration is incompatible with ”等一堆错误,如下:

Building configuration: app - Debug
Updating build tree...
at24c16.c  
Error[Pe147]: declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_PSP(void)" (declared at line 52 of "C:\Program Files  C:\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[Pe147]: declaration is incompatible with "__nounwind __interwork __softfp void __set_PSP(unsigned long)" (declared at line 53 of "C:\Program Files  C:\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[Pe147]: declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_MSP(void)" (declared at line 50 of "C:\Program Files  C:\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
完全没有任何警告和错误。





欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/) Powered by Discuz! X3.4