IAR编译问题
IAR 6.3 无法编译问题

1 在用IAR编译SVN上下载的RT-THREAD 1.0.1时,出现很多的错误,如下:......Error[Pe147]:declaration is incompatible with"__nounwind__interwork __softtp unsigned long __REV16(unsigned long)"(declared at line 177 of "C:\Program Files(x86)\IAR Systems\Embedded Workbench 6.0 Evaluation\arm\inc\c\intrinsics.h"......错误都是出现在intrinsics.h文件里,咨询过RT-THREAD设计群后解决了此问题。
方法如下:1:Project options > General Options > LibraryConfiguration 里选择USE CMSIS ;2:在Project>Options>C/C++Compiler>Preprocessor里删除所有的CMSIS header files ,“$PROJ_DIR$\..\..\..\Libraries\CMSIS\CM3\CoreSupport” 。
2. 然后出现错误将程序所在目录中的Library/CMSIS/Core/CM3文件夹下的三个.c / .h ----system_stm32f10x.c、system_stm32f10x.h 、stm32f10x.h 三个文件剪切到Library 目录下的STM32F10x_StdPeriph_Driver文件夹下lib_cfg文件夹中。
3.在打开的程序中,将Core中的system_stm32f10x.c、system_stm32f10x.h 、stm32f10x.h 三个文件remove4.右键单击Library Add Files ,将刚才复制到Library 目录下的STM32F10x_StdPeriph_Driver文件夹下lib_cfg文件夹中的三个文件再添加进来5.这样就编译通过了。
IAR编译问题

Error[Pe020]: identifier "ccc" is undefined C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 63问题:红色部分没有定义,黄色部分是路径,63是行数。
解决:先定义ccc后使用。
Fatal Error[Lc002]: could not open file "C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\..\stm32f10x_flash.icf"问题:找不到黄色路径中的文件。
解决:查找下图中路径设置是否正确。
Warning[Pa084]: pointless integer comparison, the result is always false C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 219问题:警告条件判断结果一直是假。
比如:unsigned char i = 0;if(i > 0xFF){}Error[Pe513]: a value of type "int *" cannot be assigned to an entity of type "char *" C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 219问题:两个类型不一样,不能直接赋值。
解决:Warning[Pe223]: function "spi_config" declared implicitly C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 216问题:红色部分没有声明或在其它地方声明过,但是main.c没有引用。
IAR编译错误

IAR编译错误清单Warning[Pe1665]: concatenation with "PDOR" in macro "PT" does not create a valid token E:\All learning files\IAR files\四轴\电调\VCANBLDC\Board\src\VCAN_NRF24L0.c 317警告:“PDDR”宏“PT”不创建有效的TOK级联未解1,错误:Error[Li005]: no definition for "__VECTOR_TABLE" [referenced from F:\k60 example\ E04 WOTCHDOG\Watdog\Debug\Obj\vectors.o]Error[Li005]: no definition for "__VECTOR_RAM" [referenced from F:\k60 example\E 04 WOTCHDOG\Watdog\Debug\Obj\vectors.o]Error[Li005]: no definition for "__BOOT_STACK_ADDRESS" [referenced from F:\k60 example\E04 WOTCHDOG\Watdog\Debug\Obj\vectors.o]错误原因(见下图):在linker里没有设置icf文件的路径。
说2,错误:Warning[Pe223]: function "LCD_Init" declared implicitly D:\All learning files\IA R files\exercise\Project\files\main.c 30files\exercise\Project\files\main.c 31Warning[Pe223]: function "LCD_P8x16Str" declared implicitly D:\All learning files\IAR files\exercise\Project\files\main.c 40Warning[Pe223]: function "LCD_P6x8Str" declared implicitly D:\All learning files\IAR f iles\exercise\Project\files\main.c 41Warning[Pe223]: function "LCD_CLS" declared implicitly D:\All learning files\IAR files\ exercise\Project\files\main.c 44Error[Pe020]: identifier "longqiu96x64" is undefined D:\All learning files\IAR files\exer cise\Project\files\main.c 45或者:Error[Pe101]: "uint8" has already been declared in the current scope (at line 72 of "D:\All learning files\IAR files\exercise\ D:\All learning files\IAR files\exercise\LI B\drivers\LQ12864\LQ12864.h 10Project\iar\..\..\LIB\cpu\arm_cm4.h")Error[Pe070]: incomplete type is not allowed D:\All learning files\IAR files\exercise\LI B\drivers\LQ12864\LQ12864.h 10Error[Pe065]: expected a ";" D:\All learning files\IAR files\exercise\LIB\drivers\LQ1286 4\LQ12864.h 10Error while running C/C++ Compilermain.cError[Pe101]: "uint8" has already been declared in the current scope (at line 72 of "D:\All learning files\IAR files\exercise\ D:\All learning files\IAR files\exercise\LIB\drive rs\LQ12864\LQ12864.h 10Project\iar\..\..\LIB\cpu\arm_cm4.h")Error[Pe070]: incomplete type is not allowed D:\All learning files\IAR files\exercise\LI B\drivers\LQ12864\LQ12864.h 10Error[Pe065]: expected a ";" D:\All learning files\IAR files\exercise\LIB\drivers\LQ1286 4\LQ12864.h 10Warning[Pe223]: function "LCD_Init" declared implicitly D:\All learning files\IAR files\e xercise\Project\files\main.c 30Warning[Pe223]: function "Draw_LibLogo" declared implicitly D:\All learning files\IAR files\exercise\Project\files\main.c 31files\exercise\Project\files\main.c 40Warning[Pe223]: function "LCD_P6x8Str" declared implicitly D:\All learning files\IAR f iles\exercise\Project\files\main.c 41Warning[Pe223]: function "LCD_CLS" declared implicitly D:\All learning files\IAR files\ exercise\Project\files\main.c 44Error[Pe020]: identifier "longqiu96x64" is undefined D:\All learning files\IAR files\exer cise\Project\files\main.c 45Error while running C/C++ Compiler注意:我这是把LQ12864.h中的void byte longqiu96x64[768];//void LCD_Init(void);//void LCD_CLS(void);//void LCD_P6x8Str(byte x,bytey,bytech[]);//void LCD_P8x16Str(byte x,bytey,bytech[]);//void LCD_P14x16Str(byte x,bytey,bytech[]);voidLCD_Print(byte x, byte y, byte ch[]);// void LCD_PutPixel(byte x,byte y);//void LCD_Rectangle(byte x1,byte y1,byte x2,byte y2,byte gif);//void Draw_LQLogo(void);//void Draw_LibLogo(void);看到没我都给注释了,然后出现这么多错误,最后又把本来是extern byte longqiu96x64[7 68];改成voidbyte longqiu96x64[768];于是出现了:Error[Pe101]: "uint8" has already been declared in the current scope (at line 72 of "D:\All learning files\IAR files\exercise\ D:\All learning files\IAR files\exercise\LIB\drive rs\LQ12864\LQ12864.h 10Project\iar\..\..\LIB\cpu\arm_cm4.h")Error[Pe070]: incomplete type is not allowed D:\All learning files\IAR files\exercise\LI B\drivers\LQ12864\LQ12864.h 10Error[Pe065]: expected a ";" D:\All learning files\IAR files\exercise\LIB\drivers\LQ1286 4\LQ12864.h 10Error while running C/C++ CompilerIAR 6.20编译错误清单1、①错误描述:Tool Internal Error:Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 007588A5 (reading from address 0x0)Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 007588A5 (reading from address 0x0)Error while running C/C++ Compiler②错误原因:High配置设置为Size,应该为Low2、①错误描述:Fatal Error[Pe1696]: cannot open source file "inc/hw_types.h" E:\StellarisWareM3_9D92\boards\dk-lm3s9b96\boot_demo2\boot_demo2.c 25②错误原因:C/C++ Complier(Assember)->Preprocessor->Additional include directories:$PROJ_DIR$\.$PROJ_DIR$\..$PROJ_DIR$\..\..\..3、①错误描述:Fatal Error[Pe1696]: cannot open source file "lwip/opt.h" E:\StellarisWareM3_9D92\utils\lwiplib.h 44②错误原因:C/C++ Complier-(Assember)>Preprocessor->Additional include directories:$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\apps$PROJ_DIR$\..\..\..\third_party\bget$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\ports\stellaris\include$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\src\include$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\src\include\ipv4$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\src\include\lwip$PROJ_DIR$\..\..\..\third_party4、①错误描述:Fatal Error[Pe035]: #error directive: Unrecognized COMPILER! E:\StellarisWareM3_9D92\boards\dk-lm3s9b96\drivers\set_pinout.h 59Error while running C/C++ Compiler②错误原因:C/C++ Complier-(Assember)>Preprocessor->Defined symbols: ewarm5、①错误描述:Error[Pe020]: identifier "ROM_pvAESTable" is undefined E:\StellarisWareM3_9D92\third_party\aes\aes.c 319②错误原因:6、①错误描述:Error[Li005]: no definition for "main" [referenced from cmain.o(rt7M_tl.a)]Error while running Linker②错误原因:定义函数:intmain(void){ return (0);}7、①错误描述:Error[Li005]: no definition for "main" [referenced from cmain.o(rt7M_tl.a)]Error while running Linker②错误原因:如果是库是库函数,在:General Options->Output->Output file:选择:Library项4、①错误描述:Fatal Error[Pe1696]: cannot open source file "uip.h" E:\StellarisWareM3_9D92\third_party\uip-1.0\apps\dhcpc\dhcpc.c 37②错误原因:5、①错误描述:②错误原因:$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\apps$PROJ_DIR$\..\..\..\third_party\bget$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\ports\stellaris\include$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\src\include$PROJ_DIR$\..\..\..\third_party\lwip-1.3.2\src\include\ipv4$PROJ_DIR$\..\..\..\third_party$PROJ_DIR$\..\..\..\third_party\uip-1.0$PROJ_DIR$\..\..\..\third_party\uip-1.0\uip$PROJ_DIR$\..\..\..\third_party\uip-1.0\apps$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\include$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\include\speex$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\stellaris6、①错误描述:Fatal Error[Pe035]: #error directive: You now need to define either FIXED_POINT or FLOATING_POINT E:\StellarisWareM3_9D92\third_party\speex-1.2rc1\libspeex\arch.h 65②错误原因:7、①错误描述:Fatal Error[Pe035]: #error directive: "Unrecognized/undefined driver for DISK0!" E:\StellarisWareM3_9D92\third_party\fatfs\port\dual-disk-driver.c 62Error while running C/C++ Compiler②错误原因:UART_BUFFEREDDISK0_DK_LM3S9B96DISK1_USB_MSCINCLUDE_BGET_STATS8、①错误描述:Error[Pe020]: identifier "ROM_pvAESTable" is undefined E:\SWM3_9D92(6.20)\third_party\aes\aes.c 359Error while running C/C++ Compiler②错误原因:10、①错误描述:Fatal Error[Pe035]: #error directive: You now need to define either FIXED_POINT or FLOATING_POINT E:\SWM3_9D92(6.20)\third_party\speex-1.2rc1\libspeex\arch.h 65Error while running C/C++ Compiler②错误原因:11、①错误描述:Error[Li005]: no definition for "ROM_SysCtlClockSet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\safertos_demo.o] Error[Li005]: no definition for "ROM_FlashUserGet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\lwip_task.o] Error[Li005]: no definition for "ROM_IntPrioritySet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\lwip_task.o] Error[Li005]: no definition for "ROM_GPIOPinTypeGPIOOutput" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\led_task.o]Error[Li005]: no definition for "ROM_GPIOPinWrite" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\led_task.o]Error[Lp011]: section placement failed: unable to allocate space for sections/blocks with a total estimated minimum size of 0x11e54 bytes in <[0x20000000-0x2000ffff]> (total uncommitted space 0x10000).Error while running Linker②错误原因:12、①错误描述:Error[Lp011]: section placement failed: unable to allocate space for sections/blocks with a total estimated minimum size of 0x11e54 bytes in <[0x20000000-0x2000ffff]> (total uncommitted space 0x10000).Error while running Linker。
IAR620编译错误

IAR 6.20编译错误清单1、①错误描述:Tool Internal Error:Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 007588A5 (reading from address 0x0)Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 007588A5 (reading from address 0x0)Error while running C/C++ Compiler②错误原因:High配置设置为Size,应该为Low2、①错误描述:Fatal Error[Pe1696]: cannot open source file "inc/hw_types.h"E:\StellarisWareM3_9D92\boards\dk-lm3s9b96\boot_demo2\boot_demo2.c 25②错误原因:C/C++ Complier(Assember)->Preprocessor->Additional include directories:$PROJ_DIR$\.$PROJ_DIR$\..$PROJ_DIR$\..\..\..3、①错误描述:Fatal Error[Pe1696]: cannot open source file "lwip/opt.h"E:\StellarisWareM3_9D92\utils\lwiplib.h 44②错误原因:C/C++ Complier-(Assember)>Preprocessor->Additional include directories:$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\bget$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party4、①错误描述:Fatal Error[Pe035]: #error directive: Unrecognized COMPILER! E:\StellarisWareM3_9D92\boards\dk-lm3s9b96\drivers\set_pinout.h 59Error while running C/C++ Compiler②错误原因:C/C++ Complier-(Assember)>Preprocessor->Defined symbols: ewarm5、①错误描述:Error[Pe020]: identifier "ROM_pvAESTable" is undefined E:\StellarisWareM3_9D92\third_party\aes\aes.c 319②错误原因:6、①错误描述:Error[Li005]: no definition for "main" [referenced from cmain.o(rt7M_tl.a)]Error while running Linker②错误原因:定义函数:int main(void) { return (0); }7、①错误描述:Error[Li005]: no definition for "main" [referenced from cmain.o(rt7M_tl.a)]Error while running Linker②错误原因:如果是库是库函数,在:General Options->Output->Output file:选择:Library项4、①错误描述:Fatal Error[Pe1696]: cannot open source file "uip.h" E:\StellarisWareM3_9D92\third_party\uip-1.0\apps\dhcpc\dhcpc.c 37②错误原因:5、①错误描述:②错误原因:$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\bget$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party\lwip-$PROJ_DIR$\..\..\..\third_party$PROJ_DIR$\..\..\..\third_party\uip-1.0$PROJ_DIR$\..\..\..\third_party\uip-1.0\uip$PROJ_DIR$\..\..\..\third_party\uip-1.0\apps$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\include$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\include\speex$PROJ_DIR$\..\..\..\third_party\\speex-1.2rc1\stellaris6、①错误描述:Fatal Error[Pe035]: #error directive: You now need to define either FIXED_POINT or FLOATING_POINT E:\StellarisWareM3_9D92\third_party\speex-1.2rc1\libspeex\arch.h 65②错误原因:7、①错误描述:Fatal Error[Pe035]: #error directive: "Unrecognized/undefined driver for DISK0!" E:\StellarisWareM3_9D92\third_party\fatfs\port\dual-disk-driver.c 62Error while running C/C++ Compiler②错误原因:UART_BUFFEREDDISK0_DK_LM3S9B96DISK1_USB_MSCINCLUDE_BGET_STATS8、①错误描述:Error[Pe020]: identifier "ROM_pvAESTable" is undefined E:\SWM3_9D92(6.20)\third_party\aes\aes.c 359Error while running C/C++ Compiler②错误原因:10、①错误描述:Fatal Error[Pe035]: #error directive: You now need to define either FIXED_POINT or FLOATING_POINT E:\SWM3_9D92(6.20)\third_party\speex-1.2rc1\libspeex\arch.h 65Error while running C/C++ Compiler②错误原因:11、①错误描述:Error[Li005]: no definition for "ROM_SysCtlClockSet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\safertos_demo.o]Error[Li005]: no definition for "ROM_FlashUserGet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\lwip_task.o]Error[Li005]: no definition for "ROM_IntPrioritySet" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\lwip_task.o]Error[Li005]: no definition for "ROM_GPIOPinTypeGPIOOutput" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\led_task.o]Error[Li005]: no definition for "ROM_GPIOPinWrite" [referenced from E:\SWM3_9D92(6.20)\boards\dk-lm3s9b96\safertos_demo\Debug\Obj\led_task.o]Error[Lp011]: section placement failed: unable to allocate space for sections/blocks with a total estimated minimum size of 0x11e54 bytes in<[0x-0x2000ffff]> (total uncommitted space 0x10000).Error while running Linker②错误原因:12、①错误描述:Error[Lp011]: section placement failed: unable to allocate space for sections/blocks with a total estimated minimum size of 0x11e54 bytes in <[0x-0x2000ffff]> (total uncommitted space 0x10000).Error while running Linker。
IAR 编译错误信息表

编译错误信息表15 ‘,’or’)’expected(预待’,’或‘)’) 编译器发现函数定义头部或宏定义的句法无效16 Identifier expected(期待识别符) 在声明、goto语句或预处理器行中丢失识别符17 Space or tab expected(期待空格或制表符) 必须用制表或空格字符把预处理器参数与伪指令隔开。
18 Macro parameter ‘name’ redefined(宏参数‘name’被重定义) #define语句中符号的形式参数被重复19 Unmatched #else,#endif或#elif(不匹配的# else,#endif 或#elif) 致命错误。
丢失了#if,#ifdef或#ifdef20 No such pre-processor command:’name’(无这样的预处理命令)#后随未知的识别符21 Unexpected token found in pre-processorline(在预处理器行中发现未预期的记号)在读参数部分之后预处理器行不空。
22 Too many nested parameterized macro(maxis50)(嵌套参数化宏太多)致命错误。
预处理器极限被超过。
23 Too many active macro parameters(max is250)(有效宏参数太多(最大为250))致命错误。
预处理器极限被超过。
24 Too deep macro nestiong(max is 100)(宏嵌套太深(最大为100))致命错误。
预处理器极限被超过。
25 Macro ‘name’called with too manyparameters(用太多的参数调用宏‘name’) 致命错误。
用比声明更多的参数调用参数化的#define宏。
26 Actual macro parameter too long(max is512)(实际宏参数太长(最大为512)单个宏参数不能超过源代码行的长度27 macro ‘name’called with too fewpatameters(用太少的参数调用宏‘name’) 用比声明更少的参数调用参数化#define宏28 Missing #endif(遗漏#endif) 致命错误。
IAR常见编译错误

【转】IAR常见编译错误—比较全IAR常见编译错误,比较全面的:前面的序号表示错误编号0 Format chosen cannot support bankingFormat unable to support banking.1 Corrupt file. Unexpected end of file in module module (file) encounteredXLINK aborts immediately. Recompile or reassemble, or check the compatibility between XLINK and C compiler.2 Too many errors encountered (>100)XLINK aborts immediately.3 Corrupt file. Checksum failed in module module (file). Linker checksum is linkcheck, module checksum is modcheckXLINK aborts immediately. Recompile or reassemble.4 Corrupt file. Zero length identifier encountered in module module (file)XLINK aborts immediately. Recompile or reassemble.5 Address type for CPU incorrect. Error encountered in modulemodule (file)XLINK aborts immediately. Check that you are using the right files and libraries.6 Program module module redeclared in file file. Ignoring second moduleXLINK will not produce code unless the Always generate output (-B) option (forced dump) is used.7 Corrupt file. Unexpected UBROF – format end of file encounteredin module module (file)XLINK aborts immediately. Recompile or reassemble.8 Corrupt file. Unknown or misplaced tag encountered in module module (file). Tag tagXLINK aborts immediately. Recompile or reassemble.9 Corrupt file. Module module start unexpected in file fileXLINK aborts immediately. Recompile or reassemble.10 Corrupt file. Segment no. segno declared twice in module module (file)XLINK aborts immediately. Recompile or reassemble.11 Corrupt file. External no. ext no declared twice in module module (file)XLINK aborts immediately. Recompile or reassemble.12 Unable to open file fileXLINK aborts immediately. If you are using the command line, check theenvironment variable XLINK_DFLTDIR.13 Corrupt file. Error tag encountered in module module (file)A UBROF error tag was encountered. XLINK aborts immediately. Recompile or reassemble.14 Corrupt file. Local local defined twice in module module (file) XLINK aborts immediately. Recompile or reassemble.15 This is no error message with this number.16 Segment segment is too long for segment definitionThe segment defined does not fit into the memory area reserved for it. XLINKaborts immediately.17 Segment segment is defined twice in segment definition -Zsegdef XLINK aborts immediately.18 Range error, compiler/assembler_messageSome instructions do not work unless a certain condition holds after linking.XLINK has verified that the conditions do not hold when the files are linked.For information about how to interpret the error message, see Range errors, page 12.The check can be suppressed by the -R option.19 Corrupt file. Undefined segment referenced in module module (file) XLINK aborts immediately. Recompile or reassemble.。
IAR相关问题处理办法,及其注意事项

问题一:IAR中如何做位定义,位操作以前在STVD中,使用如下语句做位定义_Bool L1 @PA_ODR : 6; //数码管个位, 低电平点亮_Bool L2 @PA_ODR : 5; //数码管十位, 低电平点亮_Bool L3 @PA_ODR : 4; //数码管百位, 低电平点亮但是同样的语句在IAR中不能用了,编译时报错。
后来,查看IAR中的头文件 "iostm8s207rb.h",看到如下语句/*-------------------------------------------------------------------------* Port A bit fields*-----------------------------------------------------------------------*/#ifdef __IAR_SYSTEMS_ICC__#define PA_ODR_ODR0 PA_ODR_bit.ODR0#define PA_ODR_ODR1 PA_ODR_bit.ODR1想想看:既然可以用PA_ODR_ODR1来指定某个位,那么我再将某个位用define重新定义为我想要的名字不就可以了吗?心动不如行动,于是写下如下语句:#define Sound_K PA_ODR_ODR6; //语音控制K原本以为十拿九稳,肯定能编译通过,结果现实狠狠地教训了我一下,报错!Error【Pe029】:expected an expression我百思不得其解,以为IAR不支持这种重复定义的方式,于是换用bool,_Bool, _bool, bit ......各种方法尝试,结果均以失败告终,事情似乎走到了尽头。
最后,抱着试一试的想法,我把原头文件中的语句#define PA_ODR_ODR6 PA_ODR_bit.ODR6换成#define Sound PA_ODR_ODR6 //语音控制K结果,编译通过了,我真是泪流满面啊,没想到问题解决了。
IAR编译cannot open the source file xxx解决办法

这属于iar配置问题可能你的例程是从别人的电脑上粘贴过来的所以出现了一个文件路径配置问题
使用 iar 时经常会出现“cannot open the source file "XXXxxx.h"”如何 解决此问题? 这属于 iar 配置问题,可能你的例程是从别人的电脑上粘贴过来的, 所以出现了一个文件路径配置问题。 如果从其他地方考过来的例程首 先要更新一下它的文件路径配置问题。如何配置请按以下步骤操作: 1、点击 file-->open-->file 2、 找到你文件所在的盘、 文件夹直到 project 的位置 有的可以复制 或 者写下来 例:F:\LCDTEST\COMMON 3、点开 options 将此路径分别粘贴到 aseembler 中的 preprocesser 下的 additional direction 和 c/c++中的 preprocess 下的此同样位置即可 4、编译即可
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Error[Pe020]: identifier "ccc" is undefined C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 63
问题:红色部分没有定义,黄色部分是路径,63是行数。
解决:先定义ccc后使用。
Fatal Error[Lc002]: could not open file "C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\..\stm32f10x_flash.icf"
问题:找不到黄色路径中的文件。
解决:查找下图中路径设置是否正确。
Warning[Pa084]: pointless integer comparison, the result is always false C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 219
问题:警告条件判断结果一直是假。
比如:unsigned char i = 0;if(i > 0xFF){}
Error[Pe513]: a value of type "int *" cannot be assigned to an entity of type "char *" C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 219
问题:两个类型不一样,不能直接赋值。
解决:
Warning[Pe223]: function "spi_config" declared implicitly C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 216
问题:红色部分没有声明或在其它地方声明过,但是main.c没有引用。
解决:如果此函数在其它文件声明过,那么在使用前声明下extern void spi_config(void);红色字体要与函数声明时保持一致,或者包含声明函数的头文件,#include "xxx.h"。
Warning[Pa093]: implicit conversion from floating point to integer C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 220
问题:float类型赋值给int类型。
Warning[Pe047]: incompatible redefinition of macro "SINGLE_ROW_NUM" (declared at line 27) C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.h 29
问题:相同的宏定义并且定义不同。
Error[Pe029]: expected an expression C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 207
问题:有格式问题,比如多了一个括号。
Error[Pe018]: expected a ")" C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 207
Error[Pe067]: expected a "}" C:\Documents and Settings\Administrator\桌面\ECG1200G-Printer-stm32\user\main.c 271
问题:缺少成对的括号。
如
问题:在main.h中定义了一个变量aaaa,此时由main.c、init.c、printer.c、stm32f10x_it.c 中都包含此头文件时,就会出现此重复定义问题。
解决:
声明此变量是main.c文件中的变量,其他*.c文件引用时都是外部变量。