[ale] gcc errors...

nomad nomad at netwide.net
Thu Aug 29 22:00:41 EDT 1996


This one is for the programming guru's (or such out there)...

I am taking ye old basic "C" refresher class.  I got permision to
use linux gcc instead of the quick c on dos.  Problem is I need to
be able to "compile it" then "link it"...  

This is my sample code:

{1}:oasis:/root/prog/>cat compile.c
main()
{
  int Var;
  printf ("Hello!\n");
  printf ("\n\n");
  printf ("Please enter an integer: ");
  scanf ("%d",&Var);
  printf ("\n\n");
  printf ("You entered %d.\n",Var);
}


I can do a "gcc compile.c" and it does everything beautifully.
But when I do a "gcc -c compile.c" and "ld compile.c" I get the
following:

-rw-r--r--   1 root     root          180 Aug 29 21:54 compile.c
-rw-r--r--   1 root     root         1092 Aug 29 21:56 compile.o
{0}:oasis:/root/prog/>ld compile.o
ld: warning: cannot find entry symbol _start; defaulting to 08048074
compile.o: In function `main':
compile.o(.text+0xc): undefined reference to `printf'
compile.o(.text+0x19): undefined reference to `printf'
compile.o(.text+0x26): undefined reference to `printf'
compile.o(.text+0x37): undefined reference to `scanf'
compile.o(.text+0x44): undefined reference to `printf'
compile.o(.text+0x55): undefined reference to `printf'

Anyone got any ideas?
Rob
--------------------------------------------------------------
Robert L. Harris
System Engineer -- Time Warner Cable, Orlando Fla.

Email:
Robert.Harris at twcable.com
Nomad at netwide.net
http://www.netwide.net/users/nomad
	
##################################################################
#Give Me Un*x or Give Me Death	#				 #
#				# My Opinions alone... Possibly  #
#There are two major products	#  borrowed from someone else,   #  
# to come out of Berkeley: LSD	#  but it's no-one you know want #
# and Unix.  Coincidence? DON'T	#  to know, and I'm expressing	 #
# THINK SO!!!			#  them as my own.		 #
##################################################################

key to UNIX:
  perl -e 'print
$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
  echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq'|dc






More information about the Ale mailing list