problem compiling c-functions
От | Aravind Babu Guntha |
---|---|
Тема | problem compiling c-functions |
Дата | |
Msg-id | 3DF5FDE5.EB89D6CD@informatik.uni-freiburg.de обсуждение исходный текст |
Ответы |
Re: problem compiling c-functions
|
Список | pgsql-admin |
i am trying to compile the below c-program.but iam getting the errors as /usr/lib/crt1.o(.text+0x18): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status #include <stdio.h> #include <stdlib.h> /* required for atoi */ int main() { char c[10]; int sum = 0; FILE *file; file = fopen("numbers3.txt", "r"); if(file==NULL) { printf("Error: can't open file.\n"); return 1; } else { printf("File opened successfully.\n"); while(fgets(c, 10, file)!=NULL) { sum += atoi(c); /* convert string to int then add it to sum */ } printf("Now closing file...\n"); fclose(file); printf("The sum of the numbers is: %d\n", sum); return 0; } } could anyone please help me in solving this problem
В списке pgsql-admin по дате отправления: