[Cialug] Using GCC

Todd Walton tdwalton at gmail.com
Sun Apr 8 06:59:13 CDT 2007


Okay, I'm not a programmer, but I'm curious like a cat.  I'm working
through getting familiar with GCC parameters using an article of that
name:
http://www.onlamp.com/pub/a/onlamp/2007/04/03/getting-familiar-with-gcc-parameters.html

I'm trying to compile the below, but I obviously don't know the first
thing about using GCC.  How do I compile this?:

#include<stdio.h>
   int main(int argc, char *argv[])
   {
   int i,j,k
   unsigned long acc=0;
   for(i=0;i<10000;i++)
        for(j=0;j<5000;j++)
                for(k=0;k<4;k++)
                        acc+=k;
   printf("acc = %lu\n",acc);
   return 0;
   }

This is how I tried:

todd at bigboss:~$ gcc -O0 gcc-trial-code.c
gcc-trial-code.c: In function 'main':
gcc-trial-code.c:5: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'unsigned'
gcc-trial-code.c:8: error: 'k' undeclared (first use in this function)
gcc-trial-code.c:8: error: (Each undeclared identifier is reported only once
gcc-trial-code.c:8: error: for each function it appears in.)
gcc-trial-code.c:9: error: 'acc' undeclared (first use in this function)
todd at bigboss:~$

-todd


More information about the Cialug mailing list