mystery linking failure

John Love-Jensen eljay@adobe.com
Tue Jan 16 12:31:00 GMT 2007


Hi Nick,

Command line arguments to gcc are processed in the order specified, one at a
time.  One pass.

Object files are taken in their entirety.

Archive files only use the internal object files which satisfy outstanding
unfulfilled symbols.

Since you are specifying your .c file (which gets compiled into a .o file)
AFTER your libraries, your library does not get used because at the time the
library is processed there are no outstanding unfulfilled symbols.

Try reordering your command line so that items with dependencies are BEFORE
those things that fulfill those dependencies.

E.g. ...
gcc -v -Wall -Wextra -g \
-o clue-keygen \
-I/usr/local/include/pbc -I../include \
-L/home/someguy/clue/lib -L/usr/local/lib \
clue-keygen.c \
-lgmp -lpbc -lpbc_sig -lclue

I'm not sure of the order of gmp, pbc, pbc_sig and clue.  Just guessing.

FYI/Note: -Wextra has replaced deprecated -W ... I'm not sure if that
occurred by 3.4.4.

The -Wblahblahblah I've been using recently for my C++ code are...
-Wmost  (like -Wall, excluding -Wparentheses)
-Wextra
-W#warning
-Wmissing-format-attribute
-Wmissing-noreturn
-Wpacked
-Wshadow
-Wcast-align
-Wcast-qual
-Wconversion
-Wdeprecated
-Wdeprecated-declarations
-Wendif-labels
-Wformat-extra-args
-Winline
-Winvalid-offsetof
-Wnon-lvalue-assign
-Wnon-virtual-dtor
-Woverloaded-virtual
-Wpmf-conversions
-Wpointer-arith
-Wshorten-64-to-32
-Wsign-compare
-Wsign-promo
-Wwrite-strings
-Wunreachable-code

Ones that I don't use but would like to enable...
-Wfloat-equal
-Wold-style-cast

Ones that I haven't decided yet...
-Weffc++
-Wnon-template-friend
-Wnormalized=id
-Wredundant-decls

HTH,
--Eljay



More information about the Gcc-help mailing list