Unable to add library to the .pro file of the target file



  • I have created a shared library in Qt 5.0.2 called "something". Now, 4 files have been created (something.pro,something.h,something_global.h and something.cpp).
    I want to use this library in another project called "trial". How to use the library "something" in "trial"?

    Please help me as I am new to Qt as well as Linux(Fedora 16).
    I know that I should use
    LIBS += [path to library files]
    INCLUDEPATH+= [path to header files]

    I am unable find the library file (something.so).
    Will "something.so" be auto generated if I have created the library?--


  • Moderators

    something.so will be created when you compile your library as a shared library. If you compile it statically, it will be something.a.

    So you need to compile your library first, and then you can start using it in your trial application.



  • Thanks! :)
    I have added the LIBS and INCLUDEPATH.

    Can you please brief me about using a function of the library in the target project file?


  • Moderators

    Just like with any Qt class/ lib: once you modify LIBS and INCLUDEPATH like you did, all that is left is to #include the header in your code and start using the functionality of that library.



  • Thank you for quick reply! will try.


  • Moderators

    You are welcome. Usually a few iterations are needed before it starts working (usually people have problems with writing correct LIBS statements, and often there are issues with supplying right paths). But in general, you should be on a good azymouth right now.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.