0

I'm trying to run simple looping code on new Appliance 2014 based on Ubuntu. However, I receive error. When I run the same piece of code, I have no problem on old appliance.

#include <stdio.h>
#include <cs50.h>

int main (int argc, string argv[])
{
    for (int i = 5; i > 0; i--)
    {
        printf ("%d\n", i);
    }
    printf ("BLAST OFF]\n");
}

Error message is following:

jharvard@ubuntu:~/pset2$ make caesar 
cc     caesar.c   -o caesar
caesar.c: In function 'main':
caesar.c:6:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 5; i > 0; i--)
     ^
caesar.c:6:5: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [caesar] Error 1

How can I fix it?

1
  • Have you tried the recommended use option -std=c99 or -std=gnu99 to compile your code? – user2477 Jan 7 '15 at 10:30
0

run update50 or, alternatively, use the Terminal app rather than the built into gedit terminal. That terminal was not configured to use the proper Make file. It was fixed in the latest update.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .