I've built a small Beowulf cluster and am now trying to compile some code I found online to do a rough benchmark of performance. The Beowulf software (Scyld Preview) is based on Redhat 7.2.
There are two small C programs I need to compile but I'm having no luck getting either to work. Both produce similar warning messages.
Being a complete beginner with C I have no idea how to proceed in identifying the source of these warnings. I've tried searching on the errors but haven't turned up anything that seems relevant.
I'd appreciate any guidance as to what might be going on and how best to go about correcting it.
(The compile command I've been using is "gcc -Wall -o sum sum.c")
Thanks
This is the shorter of the two c programs.
6.1 sum.c
/* Jacek Radajewski jacek@usq.edu.au */
/* 21/08/1998 */
#include <stdio.h>
#include <math.h>
int main (void) {
double result = 0.0;
double number = 0.0;
char string[80];
while (scanf("%s", string) != EOF) {
number = atof(string);
result = result + number;
}
printf("%lf\n", result);
return 0;
}
WARNINGS
sum.c:1: parse error before '/'
In file included from /usr/include/stdio.h:57,
from sum.c:6:
/usr/include/libio.h:263: parse error before "size_t"
/usr/include/libio.h:272: parse error before "size_t"
/usr/include/libio.h:368: parse error before "_IO_sgetn"
/usr/include/libio.h:368: parse error before "size_t"
/usr/include/libio.h:368: warning data definition has no tag or storage class
In file included from sum.c:6:
/usr/include/stdio.h:237: parse error before "size_t"
/usr/include/stdio.h:243: parse error before "size_t"
/usr/include/stdio.h:273: parse error before "size_t"
/usr/include/stdio.h:277: parse error before "size_t"
/usr/include/stdio.h:281: parse error before "size_t"
/usr/include/stdio.h:446: parse error before "fread"
/usr/include/stdio.h:446: parse error before "size_t"
/usr/include/stdio.h:447: warning data definition has no tag or storage class
/usr/include/stdio.h:449: parse error before "fwrite"
/usr/include/stdio.h:449: parse error before "size_t"
/usr/include/stdio.h:450: warning data definition has no tag or storage class
/usr/include/stdio.h:454: parse error before "fread_unlocked"
/usr/include/stdio.h:454: parse error before "size_t"
/usr/include/stdio.h:455: warning data definition has no tag or storage class
/usr/include/stdio.h:456: parse error before "fwrite_unlocked"
/usr/include/stdio.h:457: parse error before "size_t"
/usr/include/stdio.h:458: warning data definition has no tag or storage class
sum.c: In function `main':
sum.c:18: warning: implicit declaration of function `atof'
sum.c:22: warning: use of 'l' length character with 'f' type character
Relevant URLs
Index
Section Relating to C Code
Souce Code
There are two small C programs I need to compile but I'm having no luck getting either to work. Both produce similar warning messages.
Being a complete beginner with C I have no idea how to proceed in identifying the source of these warnings. I've tried searching on the errors but haven't turned up anything that seems relevant.
I'd appreciate any guidance as to what might be going on and how best to go about correcting it.
(The compile command I've been using is "gcc -Wall -o sum sum.c")
Thanks
This is the shorter of the two c programs.
6.1 sum.c
/* Jacek Radajewski jacek@usq.edu.au */
/* 21/08/1998 */
#include <stdio.h>
#include <math.h>
int main (void) {
double result = 0.0;
double number = 0.0;
char string[80];
while (scanf("%s", string) != EOF) {
number = atof(string);
result = result + number;
}
printf("%lf\n", result);
return 0;
}
WARNINGS
sum.c:1: parse error before '/'
In file included from /usr/include/stdio.h:57,
from sum.c:6:
/usr/include/libio.h:263: parse error before "size_t"
/usr/include/libio.h:272: parse error before "size_t"
/usr/include/libio.h:368: parse error before "_IO_sgetn"
/usr/include/libio.h:368: parse error before "size_t"
/usr/include/libio.h:368: warning data definition has no tag or storage class
In file included from sum.c:6:
/usr/include/stdio.h:237: parse error before "size_t"
/usr/include/stdio.h:243: parse error before "size_t"
/usr/include/stdio.h:273: parse error before "size_t"
/usr/include/stdio.h:277: parse error before "size_t"
/usr/include/stdio.h:281: parse error before "size_t"
/usr/include/stdio.h:446: parse error before "fread"
/usr/include/stdio.h:446: parse error before "size_t"
/usr/include/stdio.h:447: warning data definition has no tag or storage class
/usr/include/stdio.h:449: parse error before "fwrite"
/usr/include/stdio.h:449: parse error before "size_t"
/usr/include/stdio.h:450: warning data definition has no tag or storage class
/usr/include/stdio.h:454: parse error before "fread_unlocked"
/usr/include/stdio.h:454: parse error before "size_t"
/usr/include/stdio.h:455: warning data definition has no tag or storage class
/usr/include/stdio.h:456: parse error before "fwrite_unlocked"
/usr/include/stdio.h:457: parse error before "size_t"
/usr/include/stdio.h:458: warning data definition has no tag or storage class
sum.c: In function `main':
sum.c:18: warning: implicit declaration of function `atof'
sum.c:22: warning: use of 'l' length character with 'f' type character
Relevant URLs
Index
Section Relating to C Code
Souce Code