How to enable C99 mode in codewarrior version 10.6

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to enable C99 mode in codewarrior version 10.6

跳至解决方案
5,073 次查看
kaustubhkagalka
Contributor II

Hi,

 

I am trying to port my code to C99 mode. For this I tried

1. #pragma on C99 ;

but this comes out with warning ignoring pragma and it shoes error where I use for(int i=0,i<XX,i++) , telling ::: for loop intial declaration only allowed in C99 mode

 

2.I also tried changing the compiler command to arm-none-eabi-gcc-c99 and arm-none-eabi-gcc-std=c99, which allows me to build the project without errors when using " for(int i=0,i<XX,i++)" but shows error when I try compiling the code.For errors i am attaching the jpg.

 

 

Can someone help me to enable the C99 mode.

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
3,975 次查看
trytohelp
NXP Employee
NXP Employee

Hi,

For Kinetis, 2 build tool chains are available under MCU V10.6:

      - Freescale,

      - GCC.

According to the \CW MCU v10.6\MCU\Help\PDF\MCU_Kinetis_Compiler.pdf manual for Freescale tool, the Syntax is #pragma c99 on | off | reset

For instance:

      #pragma c99 on

According to the \CW MCU v10.6\MCU\Help\PDF\MCU_Kinetis_GCC.pdf manual for GCC tool, C99 can not be used through a pragma.

Under propject properties for the language Standard you can select ISO C99 option.

The option can be define by #define C99.

For details I recommend you to:

      - check the build tool chain used (it seems to be the GCC),

      - perform a search for C99 in the corresponding compiler manual.

Hope this will help you.


Have a great day,
Pascal Irrle

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
2 回复数
3,975 次查看
kaustubhkagalka
Contributor II

Hi Pascal,

Thanks for the answer I looked up in the correct manual and found the solution. I was referring older version uptill now. :smileyplain:

Thanks!!

0 项奖励
回复
3,976 次查看
trytohelp
NXP Employee
NXP Employee

Hi,

For Kinetis, 2 build tool chains are available under MCU V10.6:

      - Freescale,

      - GCC.

According to the \CW MCU v10.6\MCU\Help\PDF\MCU_Kinetis_Compiler.pdf manual for Freescale tool, the Syntax is #pragma c99 on | off | reset

For instance:

      #pragma c99 on

According to the \CW MCU v10.6\MCU\Help\PDF\MCU_Kinetis_GCC.pdf manual for GCC tool, C99 can not be used through a pragma.

Under propject properties for the language Standard you can select ISO C99 option.

The option can be define by #define C99.

For details I recommend you to:

      - check the build tool chain used (it seems to be the GCC),

      - perform a search for C99 in the corresponding compiler manual.

Hope this will help you.


Have a great day,
Pascal Irrle

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复