pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem compiling c-functions
2+ messages / 2 participants
[nested] [flat]
* problem compiling c-functions
@ 2002-12-10 14:44 Aravind Babu Guntha <guntha@informatik.uni-freiburg.de>
0 siblings, 1 reply; 2+ messages in thread
From: Aravind Babu Guntha @ 2002-12-10 14:44 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: problem compiling c-functions
@ 2002-12-11 14:05 Oliver Elphick <olly@lfix.co.uk>
parent: Aravind Babu Guntha <guntha@informatik.uni-freiburg.de>
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Elphick @ 2002-12-11 14:05 UTC (permalink / raw)
To: Aravind Babu Guntha <guntha@informatik.uni-freiburg.de>; +Cc: pgsql-admin
On Tue, 2002-12-10 at 14:44, Aravind Babu Guntha wrote:
> 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
You need to show us the command line you are using to compile it.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The spirit of the Lord GOD is upon me; because the
LORD hath anointed me to preach good tidings unto the
meek; he hath sent me to bind up the brokenhearted, to
proclaim liberty to the captives, and the opening of
the prison to them that are bound."
Isaiah 61:1
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-12-11 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10 14:44 problem compiling c-functions Aravind Babu Guntha <guntha@informatik.uni-freiburg.de>
2002-12-11 14:05 ` Oliver Elphick <olly@lfix.co.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox