[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build a lib, then example programs

From: Alexandre Duret-Lutz
Subject: Re: Build a lib, then example programs
Date: Thu, 09 Aug 2007 09:17:21 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

 m> I keep getting 'undefined reference' errors when I try to
 m> compile them, even if the library has already been built.

You're likely linking with the installed version, not the one
you just built.

 m> My example program is udpclient. How would I link udpclient to libdconn.a,
 m> and how would I make sure that udpclient isn't built before libdconn.a?

use -l... only for system libraries
spell out the actual filename for you own libraries
use LDADD (not LDFLAGS) to specify libraries a program should link against

AM_LDFLAGS = -pthread 
LDADD = libdconn.a -lz

lib_LIBRARIES = libdconn.a
libdconn_a_SOURCES = ...

noinst_PROGRAMS = udpclient
udpclient_SOURCES = ...

Alexandre Duret-Lutz

Shared books are happy books.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]