Oct 31, 2014

Eclipse C/C++: for loop initial declarations are only allowed in C99 mode

Problem: you declare a variable in the for loop in Eclipse and you get the error message:

'for' loop initial declarations are only allowed in C99 mode

Solution: use the option -std=c99 for your compiler! Go to: Project > Properties > C/C++ Buils > Settings > Tool Settings > GCC C Compiler > Dialect > Language Standard: choose "ISO C99"

Project > Properties

C/C++ Buils > Settings > Tool Settings > GCC C Compiler > Dialect > Language Standard: choose "ISO C99"


3 comments:

  1. Great Bro , you are awesome

    ReplyDelete
  2. Great. Thanks.
    Struggling for it from long time.

    ReplyDelete
  3. how to overcome this error ‘for’ loop initial declarations are only allowed in C99 mode as i am using hadoop

    ReplyDelete