On Aug 9, 2007, at 12:58 AM, myrdos2 wrote:
I've been trying to use the autotools to compile a static library. The lib itself compiles and installs OK, but I'm having trouble with the example programs. These programs must be linked with the lib to compile. I keep getting 'undefined reference' errors when I try to compile them, even if thelibrary has already been built. Makefile.am: ## Process this file with automake to produce Makefile.in AM_CXXFLAGS = -D_REENTRANT -Wall AM_LDFLAGS = -pthread -ldconn -lz lib_LIBRARIES = libdconn.a libdconn_a_SOURCES = DyConnect.cpp \ libdconn/DasyneInterface.cpp \ ... libdconn/sync/SyncClient.cpp \ libdconn/sync/SyncServerFSM.cpp nobase_include_HEADERS = DyConnect.h \ libdconn/DasyneInterface.hpp \ ... libdconn/sync/SyncEngine.hpp \ libdconn/sync/SyncServerFSM.hpp
Hmm, that's not related to your problem but I *think* that you should do something like this:
nobase_include_HEADERS = DyConnect.h \ libdconn/DasyneInterface.hpp \ ... libdconn/sync/SyncEngine.hpp \ libdconn/sync/SyncServerFSM.hpp libdconn_a_SOURCES = $(nobase_include_HEADERS) \ DyConnect.cpp \ libdconn/DasyneInterface.cpp \ ... libdconn/sync/SyncClient.cpp \ libdconn/sync/SyncServerFSM.cppIn order to get proper dependency tracking from automake, can anyone confirm this? (as I'm not sure)
Moreover I don't know whether this is intended but the _HEADERS primary is used to specify headers that must be installed. If you did not mean this, you do better just list the headers in the libdconn_a_SOURCES.
Cheers, -- Benoit Sigoure aka Tsuna EPITA Research and Development Laboratory
PGP.sig
Description: This is a digitally signed message part