Results 1 to 2 of 2

Thread: C++ Static library Eclipse

  1. #1
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default C++ Static library Eclipse

    Hello,

    I am trying to include a static library in QT, but it doesn't seem to see my classes.
    This is how I included it in the .pro file

    LIBS += "../Src/Debug/libSrc.a"
    INCLUDEPATH += "../Src/."

    The library is in the same workspace as the qt app.

    Thanks,
    Andrei

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: C++ Static library Eclipse

    Are the paths correct?
    If you can't see your classes it means that INCLUDEPATH doesn't point to correct place.
    Try using absolute path rather than relative, maybe working directory is something totally different than you think, then relative path will be wrong.

    Also I find it odd that your lib name is 'src'... anyway, with libs use -L and -l, plus quotes may mess up things.
    Qt Code:
    1. INCLUDEPATH += C:\Development\projects\FileIO // correct, absolute path to your headers
    2. LIBS += -L C:\Development\projects\FileIO-build-desktop\debug -l FileIO // correct and absolute path to directory containing your compiled library and that library name as it stands in that library project, not file name.
    3. // the line above points to this file: C:\Development\projects\FileIO-build-desktop\debug\libFileIO.a
    To copy to clipboard, switch view to plain text mode 
    ps. use [code] tag in a future.

Similar Threads

  1. Replies: 2
    Last Post: 19th February 2011, 11:26
  2. Replies: 7
    Last Post: 22nd December 2010, 08:13
  3. Using a static library
    By Cruz in forum Newbie
    Replies: 2
    Last Post: 26th January 2010, 17:00
  4. how to use static library in qt4?
    By hashb in forum Qt Programming
    Replies: 9
    Last Post: 28th October 2009, 12:46
  5. Static library?
    By shiranraviv in forum Qt Programming
    Replies: 4
    Last Post: 15th October 2009, 14:11

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.