Results 1 to 2 of 2

Thread: Indicating to QtCreator the path to my dlls

  1. #1
    Join Date
    Jun 2011
    Porto Alegre, Brazil
    Thanked 2 Times in 2 Posts
    Qt products
    Unix/X11 Windows

    Default Indicating to QtCreator the path to my dlls


    Recently I changed the organization of one of my projects and after trying to run it again from Qt Creator, I got a startup message error saying that it couldn't run (not even QApplication was called in the main function). I did some research on the web and discovered that this was a problem I had encountered before: Qt Creator wasn't being capable of doing the linking with the dlls that are called at run-time.

    I found that strange, because I thought that I did all the linking in the .pro file correctly not to mention I was using "QApplication::setLibraryPath" (which in this case wasn't useful since the code wasn't even going there). So I copied all the used dlls to the same place where the .exe was located and, after that, the problem vanished.

    My question is: how can I tell Qt Creator to look for the .dlls in any place I want instead of always having to have a copy of each dll inside the same folder where my .exe is located? I guess it should be in the .pro file, but I don't know which command to use (LIBS += C:/Qt/Qwt-6.1.0/lib/qwtd.dll , for example, is not working for that); DEPENDPATH doesn't seems to be the case.

    I'm glad for any help!


    May the Lord be with you. Always.

  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default Re: Indicating to QtCreator the path to my dlls

    There are two times when an application needs to find the dynamic libraries: when you build it and when you run it.

    The first usage is covered by LIBS, it should contain the path to a library and the name of the library, usually that will look like this

    Qt Code:
    1. LIBS += -Lpath-to-library -lname-of-library-without-extension
    To copy to clipboard, switch view to plain text mode 

    This will allow qmake to generate the respective input for the built time linker.

    The other usage is at start time, when the system's runtime linker needs to find the symbol that the libraries provide.
    Each system has different rules how to find them, e.g. on Windows one of the search paths is the path the .exe is in.


Similar Threads

  1. Replies: 0
    Last Post: 14th May 2013, 21:00
  2. Replies: 5
    Last Post: 6th June 2011, 09:56
  3. Replies: 1
    Last Post: 5th January 2011, 13:19
  4. Indicating/catching signals
    By Tomasz in forum Newbie
    Replies: 5
    Last Post: 30th September 2010, 13:24

Tags for this Thread


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.