Results 1 to 7 of 7

Thread: Custom library problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Custom library problem

    Hello,

    first of all, my aplogies for posting this again. I've researched the forum and I've found plenty of old posts similar to this one. The thing is, all of them were solved by modifying the .pro file, which has not worked for me (I think my pro file is ok). Instead of resurrecting a dead post I created a new one.

    The problem is the inclusion of a library I made myself, called libCCCI.so into Qt4. I use eclipse Helios on a Ubuntu 10.04. The library libCCCI.so is in a folder called libs within my eclipse project.

    My .pro file looks like this:
    TEMPLATE = app
    TARGET = EPSI
    QT += core gui
    HEADERS += epsi.h
    SOURCES += main.cpp \
    epsi.cpp
    FORMS += epsi.ui
    RESOURCES +=
    INCLUDEPATH += ./libs
    LIBS += -lCCCI

    (I proved all set of combinations in the LIBS parameter, -Lfull path -l library, -Lrelative path -l library etc, but only got replicated -l entries in the g++ line and no solution)

    The resultant g++ call is:
    g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Ilibs -Idebug -I. -o debug/main.o main.cpp

    So the directory is included (-Ilibs) but for some reason Qt4 does not see it. I also copied the library to the root of the project since it is also included (-I.) to see if it saw it there. It did not.

    I also added the library in the project->properties->C/C++ project paths->Libraries
    And the "libs" path in project->properties->C/C++ include paths and symbols

    I run make clean, qmake, make and it gives the next errors:
    For the include of header files from the library: No such file or directory
    For the objects of the library: Does not name a type.

    If I run the project regardless of the errors, I get the following message:
    error while loading shared libraries: libCCCI.so: cannot open shared object file: no such file or directory
    This is what makes me angry. It knows it is there. Somewhere. But it does not see it.

    Thanks to anyone who even bother reading this. I've already lost 4 days of work with this issue and I'm starting to get desperate (and so is my boss). If anyone could at least tell me if there is a problem with my pro file, that would be great.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Custom library problem

    For the include of header files from the library: No such file or directory
    Where is this header located ? In the "libs" directory ?
    If you want to use shared library in C app, you'll need header as well, not only .so file.

    Try to:
    0) fix the include .h error, this one has nothing to do with the fact that you are using .so file
    1) modify LD_LIBRARY_PATH to contain directory with .so library
    2) if it fails try to load it dynamically ( with dlopen("/path/to/lib.so") ) and eventually check error ( dlerror() )

    -----
    edit:
    now I saw this
    INCLUDEPATH += ./libs
    is this just a typo in your post ? or you have this line in .pro file ?
    Did you mean
    INCLUDEPATH += . libs
    ?
    Last edited by stampede; 2nd February 2011 at 17:58.

Similar Threads

  1. Problem loading custom library in Qt4.5
    By ches in forum Newbie
    Replies: 2
    Last Post: 10th March 2009, 19:46
  2. custom widget library?
    By ihoss in forum Newbie
    Replies: 3
    Last Post: 16th September 2007, 16:39
  3. so shared library problem
    By mtrpoland in forum Newbie
    Replies: 3
    Last Post: 13th August 2007, 21:51
  4. Replies: 1
    Last Post: 5th March 2007, 20:50
  5. shared library problem
    By nhatkhang in forum KDE Forum
    Replies: 9
    Last Post: 28th November 2006, 04:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.