Re: [QUESTIONS] pginterface compiling

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "Jose' Soares Da Silva" <sferac(at)proxy(dot)bazzanese(dot)com>
Cc: hackers postgres <pgsql-hackers(at)postgreSQL(dot)org>, questions postgres <pgsql-questions(at)postgreSQL(dot)org>
Subject: Re: [QUESTIONS] pginterface compiling
Date: 1998-04-23 13:20:26
Message-ID: 199804231420.PAA10137@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Jose' Soares Da Silva" wrote:
>Hi, all
>
>I have this message when I try to compile pginterface...
>Please help...
>
>$ make all
>cc -c -g -Wall -I/usr/local/pgsql/include pginterface.c halt.c
>cc -g -Wall -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq -o
>.c
>/usr/lib/crt1.o: In function `_start':
>/usr/lib/crt1.o(.text+0x5a): undefined reference to `main'
>make: *** [.c] Error 1

Well, you don't seem to have specified any files to link. The second
cc command says to create an executable called `.c' but doesn't specify
and files to compile or link, except the libpq library. So naturally, cc
cannot find a main() routine; that is what it is complaining about.

Ah, I see it's not your fault but the Makefile's...

I guess you are using GNU make, as I am. This works for me:

=======================================================
#
# Makefile for GNU make
#
#
PGINTERFACE = pginterface.o halt.o
TARGET = pginsert pgwordcount pgnulltest
CFLAGS = -g -Wall -I/usr/local/pgsql/include -I.
LDFLAGS = -L/usr/local/pgsql/lib -lpq

all : $(TARGET)

$(TARGET): %: %.o ${PGINTERFACE}
$(CC) -o $@ $(CFLAGS) $(at)(dot)c ${PGINTERFACE} $(LDFLAGS)

clean:
rm -f *.o $(TARGET) log core

install:
make clean
make CFLAGS=-O
install -s -o bin -g bin $(TARGET) /usr/local/bin
=======================================================

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver

PGP key from public servers; key ID 32B8FAA1

========================================
Come to me, all you who labour and are heavily laden, and I will
give you rest. Take my yoke upon you, and learn from me; for I am
meek and lowly in heart, and you shall find rest for your souls.
For my yoke is easy and my burden is light. (Matthew 11: 28-30)

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-23 13:52:06 Re: [HACKERS] multi-byte aware char_length() etc.
Previous Message Peter Mount 1998-04-23 13:20:05 RE: [HACKERS] Oops