gcc setup
What have I failed to do in installing gcc on Debian.
Most recent version (4.0rev1 "etch")
My anal1.c file is as follows.
struct struct1 {
char nam[5];
char code[2];
unsigned long int date;
double open;
double high;
double low;
double close;
unsigned long int volume;};
struct1 struct2[750];
FILE *file = fopen("amex1.txt", "r");
if ( file != NULL )
{
char line [ 80 ];
size_t count, i = 0;
while ( i < 750 )
{
if ( fgets(line, sizeof line, file) == NULL )
{
break;
}
if ( sscanf(line, "%s,%s,%u,%d,%d,%d,%d,%u.%lf", struct1[i].nam, struct1[i].code,
struct1[i].date, struct1[i].open, struct1[i].high,
struct1[i].low, struct1[i].close, struct1[i].volume ) == 8 )
{
++i;
}
}
fclose(file);
for ( count = i, i = 0; i < count; ++i )
{
printf("struct1[%i]: nam = %s, code= %s, date = %u, open = %d, high = %d,low= %d, close= %d, volume = %u\n",
i, struct1[i].nam, struct1[i].code, struct1[i].date,
struct1[i].open, struct1[i].high, struct1[i].low, struct1[i].close, struct1[i].volume);
}
}
else
{
perror("amex1.txt");
}
return 0;
}
The folffowing output makes no sense
eric@debian:~/data$ gcc anal1.c
anal1.c: In function ‘main’:
anal1.c:18: error: ‘struct1’ undeclared (first use in this function)
anal1.c:18: error: (Each undeclared identifier is reported only once
anal1.c:18: error: for each function it appears in.)
anal1.c:18: error: expected ‘;’ before ‘struct2’
eric@debian:~/data$
|