Results 1 to 8 of 8

Thread: Linking a .a and .dll library to Qt project

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2012
    Posts
    31
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Linking a .a and .dll library to Qt project

    Hi, I am currently developing a qt sub directory project. This is the structure:

    Root Project:
    Root.pro
    Subdir Project:
    Subdirapp.pro - TEMPLATE = app
    Subdirlib1.pro - TEMPLATE = lib
    Subdirlib2.pro - TEMPLATE = lib
    Subdirlib3.pro - TEMPLATE = lib
    Subdirlib4.pro - TEMPLATE = lib


    First, I would like to ask how can I create a shared library for the subdirectory projects(Subdirlib1.pro,Subdirlib2.pro,Subdirlib3. pro and Subdirlib4.pro).
    Second, I would like to ask how can I link those subdir projects using this shared library allowing me to use UI and functions of every

    Upon building the projects. ".a" and ".dll" were generated.
    I am currently working on MINGW build configuration.

    I really need your help guys! Please.
    Thanks in advance

    -ehnuh-

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Linking a .a and .dll library to Qt project

    If you have DLL generated for each library sub project then you already have shared libraries.

    In the app project pro file you add the libraries/library paths you wish to link against to the LIBS variable and, if necessary, add an include search directory to INCLUDEPATH.

  3. #3
    Join Date
    Sep 2012
    Posts
    31
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linking a .a and .dll library to Qt project

    Hi sir, currently I have tried this method:


    ..I am currently using mingw compiler, so the library file format generated is a '.a' and '.dll' format.

    I added the library using 'add internal library'. This generated the code in my .pro file.

    unix:!symbian|win32: LIBS += -L$$OUT_PWD/../../../BiTCommon/Template/Project/ -lTemplate

    INCLUDEPATH += $$PWD/../../../BiTCommon/Template/Include
    DEPENDPATH += $$PWD/../../../BiTCommon/Template/Include


    ..upon building the project, it gives me this error.
    'cannot find -lTemplate'


    ..Next I tried to change the -lTemplate to -aTemplate since the library generated was in a '.a' format. Upon building there were no errors but when I instantiated the class it gave me this error.


    error: undefined reference to `_imp___ZN19CTemplateMainWindowC1EP7QWidget'



    ..any inputs would really be helpful. To cut the long story short, I was previously compiling in msvc and it generated .lib files and I just link it to my project. Now that it is in mingw, it generates a different file format.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Linking a .a and .dll library to Qt project

    You are telling Qt that there is a library called "libTemplate.a" in a folder "$$OUT_PWD/../../../BiTCommon/Template/Project/" (wherever that resolves to) or elsewhere on the standard path. I guess it is not there.

Similar Threads

  1. Linking DLL to Project
    By lynchkp in forum Newbie
    Replies: 4
    Last Post: 29th January 2012, 06:36
  2. Problem linking against library
    By PowerPlate in forum Qt Programming
    Replies: 3
    Last Post: 15th October 2011, 03:45
  3. linking .so library in Qt on Mac Platform.
    By syclopse in forum Qt Programming
    Replies: 0
    Last Post: 18th August 2011, 11:50
  4. Help needed linking to library
    By StephenR in forum Qt Programming
    Replies: 4
    Last Post: 3rd July 2009, 09:50
  5. linking qt3 to a library
    By thebra in forum Newbie
    Replies: 10
    Last Post: 11th November 2006, 02:25

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.