Circular linking of libraries in C/C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gerd Keller
    New Member
    • Aug 2010
    • 2

    #1

    Circular linking of libraries in C/C++

    Hello,

    I have following problem: I use a Qt GUI frontend where I use the QImage.load function which uses for jpeg the free libjpeg. In this application i link another shared library which also uses libjpeg. with this setup my application crashes with a segmentation fault in an libjpeg function. When i remove the dependency of the linked shared library to libjpeg the application is working. Thats why i am pretty shure that the "circular" linking to libjpeg is the problem. the usual header #ifndef XXX #define XXX #endif precompiler statements dont help. what should i do to solve the problem? this must be a standard problem because many libraries link to the same standard libs like libjpeg. is there a standard approach like the "#ifndef" for the compiler?

    my Setup is gcc on Ubuntu/Linux
  • Gerd Keller
    New Member
    • Aug 2010
    • 2

    #2
    I got it! I had two different libjpeg versions installed: 6.2 and 8. When linking to 8 ; which i had been built by myself and was installed in /usr/local/lib - the application crashed. The Reason why Qt has problems with libjpeg8 is not clear to me but the solution was to remove libjpeg8.

    Comment

    Working...