compiling in Fedora
From: Dave (kaatzd_at_hotmail.com)
Date: 08/18/04
- Previous message: William Ahern: "db.h, db_185.h"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: compiling in Fedora"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 17 Aug 2004 16:34:29 -0700
Hello all,
I have read with interest some recent threads about make files and
such.
I am trying to port a simple socket host example program from unix to
linux - Fedora actually.
It isn't working, so I created a hello world program. It also doesn't
work, but I cannot tell why. I think a linking problem. But I read in
other threads that I should let gcc do the linking for me. OK, here is
my make file:
===================
# hello world test program
TARGET=hello
SOURCE=$(TARGET).c
OBJECTS=$(TARGET)$(OBJ)
CC=gcc
COPT= -Wall
DFLAGS=
EXE=
OBJ=.o
SLASH=/
$(TARGET)$(EXE) : $(OBJECTS)
$(CC) $(COPT) $(DFLAGS) $(OBJECTS) -o $@
clean :
- rm -f $(TARGET).o $(TARGET)$(EXE)
====================
The output seen when compiling is this:
gcc -c -o hello.o hello.c
gcc -Wall hello.o -o hello
And a hello file is made with execute permissions for all users.
When I type hello at the command prompt, I get this:
bash: hello: command not found
So I tried compiling separately and linking with ld, thus:
===== separate linking makefile snippet ============
COPT=-c -Wall
$(TARGET)$(EXE) : $(OBJECTS)
ld $(OBJECTS) -o $(TARGET)$(EXE)
$(OBJECTS) : $(SOURCE)
$(CC) $(COPT) $(DFLAGS) $(SOURCE)
==================================
The results of running make:
gcc -c -Wall hello.c #-o hello
ld hello.o -o hello
ld: warning: cannot find entry symbol _start; defaulting to 08048094
hello.o(.text+0x19): In function `main':
: undefined reference to `printf'
make: *** [hello] Error 1
Am I missing library files? Where should they reside? I cannot find
any glibc* files on the system, except for a couple glibconfig.h files.
Thanks,
Dave
- Previous message: William Ahern: "db.h, db_185.h"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: compiling in Fedora"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|