Problems linking static library on executable and static library

Problems linking static library on executable and static library

Post by Raúl Sánch » Thu, 22 May 2003 00:44:51

  I'm a newbie in programming on Un*x platforms, so maybe, it could
be caused by my lack of experience.

Ok. I have a static library "libSM.a" depending on two libraries one
of them shared: "" and a static one: "libCB.a"

I'm trying to compile an executable "EInvA" linking with both "libSM.a" and
"libCB.a" and get the following error:

CC  -mt -fast -DNONE_CLASH -o RELEASE/EInvA     RELEASE/inva.o
-lsocket -lnsl -ldl -lCstd -lc -lnsl -lsocket -lclntsh
-L/libs/libSM/STATIC -lSM -L/libs/libCB/STATIC -lCB

Undefined symbol                 first referenced in file

int CB::Connect(char*, char*) /libs/libSM/STATIC/libSM.a (libSM.o)
CB::CB()                      /libs/libSM/STATIC/libSM.a (libSM.o)
CB::~CB()                     /libs/libSM/STATIC/libSM.a (libSM.o)

And "CB" symbols are defined in "libCB.a"

?Could someone tell me what could be happening?

Thanks in advanced,


1. linking static library against another library


I'm trying to link a static library against another static library, but I
get lot of 'undefined reference' errors.

here's what I have

        some cpp files resulting to libCommon.a

        some cpp files, which use classes from /Common, resulting to
        main.cpp, using libSimulation.a

I want compile all the /Common stuff into a single static library,
libCommon.a. This will then get used by libraries for specific
applications, e.g. Simulation. I want the /Simulation stuff also to be
compiled into a library, which uses the libCommon.a

Both libraries compile and link, but when I try to link the main executable
it complains about undefined references in libSimulation.a

Some help please?



2. Setting Up PPP for LinuxPPC

3. dynamic link libraries and static libraries

4. wireless not working

5. link static libraries into a shared library

6. CD. Which do I get?

7. Problem with static linking of xview library in 2.6

8. install RED HAT 5.1 on P2B-DS with adaptec AIC 7890

9. static library linking problem

10. Static library linking problems

11. (gcc) problems linking shared and static libraries.

12. problem linking with static library