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"


2 comments:

  1. Great Bro , you are awesome

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

    ReplyDelete