How to enable C99 mode in codewarrior version 10.6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to enable C99 mode in codewarrior version 10.6

Jump to solution
2,666 Views
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.

Labels (1)
Tags (2)
0 Kudos
1 Solution
1,568 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
1,568 Views
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 Kudos
1,569 Views
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 Kudos