Operating System - HP-UX
1847587 Members
4079 Online
110265 Solutions
New Discussion

Re: undefined reference to `main'

 
William Harris_4
Occasional Contributor

undefined reference to `main'

i'm getting the following error attempting to create some shared libraries:

/usr/lib/crt1.o(.text+0x18): undefined reference to `main'

here's my makefile:

# This make file creates a library to be used with different programs

@SRCS = daemonStart.c getDateTime.c set_user_id.c

OBJS = daemonStart.o getDateTime.o set_user_id.o

CCFLAGS = -c -g -z +z

CC = gcc

LIBS = libckfr.a libckfr.so

all: libckfr.a libckfr.so

libckfr.a: $(OBJS)
@@echo "Loading $@ ..."
@@rm -f $@
ar cru $@ *.o
@@echo "Done"

libckfr.so: $(OBJS)
@@echo "Loading $@ ..."
@@rm -f $@
$(CC) -b -g -o $@ *.o ***problem here***
@@echo "Done"

daemonStart.o: daemonStart.c
$(CC) $(CCFLAGS) daemonStart.c

getDateTime.o: getDateTime.c
$(CC) $(CCFLAGS) getDateTime.c

set_user_id.o: set_user_id.c
$(CC) $(CCFLAGS) set_user_id.c

clean:
rm -f *~ *.o core $(LIBS)

thanks in advance,

chris
2 REPLIES 2
Mark Greene_1
Honored Contributor

Re: undefined reference to `main'

Looks like it may be a syntax error in the C code. Do you have a version of lint you can run against the source?

mark
the future will be a lot like now, only later
William Harris_4
Occasional Contributor

Re: undefined reference to `main'

i solved the problem. i used the ld command to make the shared library. program compiled okay.