Results 1 to 2 of 2

Thread: how to add a static lib to my project

  1. #1
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to add a static lib to my project

    I'm not sure how to do this correctly...

    I've written a set of libs and compiled them with the Makefile produced from a .pro-file with the following settings:

    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += qt staticlib
    3. ...
    4. ...
    To copy to clipboard, switch view to plain text mode 

    I've then written a program that wishes to make use of the static libs. That .pro-file looks something like this:

    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += debug warn_on console
    3. DEPENDPATH += .
    4. INCLUDEPATH += . $(MYLIB)/headers
    5.  
    6. SOURCES += main.cpp
    7. HEADERS += testclass.h
    8.  
    9. LIBS += -L$(MYLIB)/bin -lmylib
    To copy to clipboard, switch view to plain text mode 

    Compilation of the test program works fine, but i get symbol referencing errors in the linking process. Have i missed some painfully obvious step here??

    thanks in advance!

  2. #2
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to add a static lib to my project

    Upon closer inspection, the referencing errors that were being produced all referred to network and xml classes. I had added QT += network xml to the .pro-file of my lib, but since the lib's compilation doesn't actually link anything, i'm guessing i have to add that line to my test program's .pro-file instead.

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 17:41
  3. Accessing to a static variable from the same class
    By xgoan in forum General Programming
    Replies: 6
    Last Post: 5th March 2007, 10:50
  4. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43
  5. Replies: 2
    Last Post: 11th July 2006, 14:19

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.