delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/26/06:24:16

Date: Thu, 26 May 1994 10:59:46 +0100
To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: mag1007 AT hermes DOT cam DOT ac DOT uk (Martin Granell)
Subject: Creating a library

        I still can't get the library to link. I create the library, put it 
in c:\djgpp\lib, as libwatcp.a, then use gcc -o merc -lwatcp.a *.o
        It compiles fine, but when it tries to link I get lots of undefined 
refernces. It is finding the library, but not the symbols. If I run nm -s 
libwatcp.a, it has the functions as _<FunctionName>. So the functions are 
there, but not being found.....Very frustrating...
        Here are the makefiles for the library and my routines....

                Any help would be appreciated.

                        Martin.
-----------------------------------------------------------------
.SUFFIXES: .c .s

STD_DEFINES = -DSYSV -DSYSV386
# -DTCPDEB
STD_CPP_DEFINES = -DSYSV -DSYSV386



GCCFLAGS = -DNO_ASM -fstrength-reduce -fwritable-strings -fpcc-struct-return

CFLAGS = -g $(INCLUDES) $(DEFINES) $(STD_DEFINES) $(GCCFLAGS)

INCLUDES = -I. -I../system

AR = ar clq 
AS = as
CC = gcc
CPP = cpp $(STD_CPP_DEFINES)
RM = del
RL = ranlib

OBJS =	pcstat.o bsdname.o fragment.o select.o \
	test.o pcbootp.o sock_dbu.o sock_prn.o \
	sock_ini.o pcbsd.o pcrecv.o pcconfig.o \
	pcbuf.o udp_nds.o udp_dom.o pcicmp.o \
	pcping.o pcarp.o pcsed.o pctcp.o \
	intel.o inchksum.o pcpkt.o elib.o

.c.o:
# 	$(RM) $@
	$(CC) -c $(CFLAGS) $*.c

.s.o:
# 	$(RM) $@
	$(CPP) $*.s >$*.i
	$(AS) -o $*.o $*.i
	$(RM) $*.i

all: libwatcp.a

libwatcp.a: $(OBJS)
 	$(RM) $@
	$(AR) $@ $(OBJS)
 	$(RL) $@
        copy $@ c:\djgpp\lib
-------------------------------------------------------
My makefile......
CC      = gcc
CC2     = gcc-16B
PROF    = -g
NOCRYPT =
C_FLAGS =  -Wall -Ic:/djgpp/include/tcp $(PROF) $(NOCRYPT)
L_FLAGS =  $(PROF) -lwatcp

 O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o comm.o const.o \
          db.o fight.o handler.o interp.o magic.o mob_comm.o mob_prog.o   \
 	  save.o special.o update.o socket.o


merc: $(O_FILES)
	rm merc
	$(CC2) $(L_FLAGS) -o merc *.o

.c.o: merc.h
	$(CC2) -c $(C_FLAGS) $<
-------------------------------------------------------------------


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019