This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
Re: Question
- To: Jeff Lu <jklcom at mindspring dot com>
- Subject: Re: Question
- From: "Charles S. Wilson" <cwilson at ece dot gatech dot edu>
- Date: Tue, 24 Oct 2000 12:26:08 -0400
- CC: cygwin at sourceware dot cygnus dot com
- References: <NDBBIHPECLIGKCCLMACAIEHJCHAA.jklcom@mindspring.com>
Jeff Lu wrote:
>
> I compiled it with CFLAGS=-DGDBM_STATIC such as this
> gcc -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c -DGDBM_STATIC
>
> This takes care of the rename problem but am still getting dbm_open,
> dbm_fetch etc. as undefined reference
>
> I've even tried to explicitly link it to /usr/lib/libgdbm.a but that didn't
> help
>
Okay, so it appears that you want to link statically and not use the
dll, right? You can do this because the gdbm package provides *both* a
static lib *AND* a dll+import library.
If you want to link statically, then you need to add "-static" to your
link command. Now, since you are going straight from .c files to an
executable all in one step, your compile command and your link command
are the same. So, do this:
gcc -static -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c
-DGDBM_STATIC
You could also do this:
# compile
gcc -o getdata.o -c getdata.c -DGDBM_STATIC
gcc -o utils.o -c utils.c -DGDBM_STATIC
#link
gcc -static -o /home/jeff/getdata.cgi getdata.o utils.o -lgdbm
--Chuck
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com