Results 1 to 3 of 3

Thread: Relative paths in Qt

  1. #1
    Join Date
    Jun 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Relative paths in Qt

    I want to link a custom widget plugin (called for example MyWidget.dll) to a Qt project (developed on Win Xp), accessing to the linked file without moving it from its release directory (whatever). Of course LIBS += C:\Path_to_dll\MyWidget.dll meets the purpose, but I have to expressly use the relative path. How can I do that?

  2. #2
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Relative paths in Qt

    Hi,

    I think that you need the relative path because in the future installation, you dont know where the user will install the app, right?

    I suggest to use the environmental variable that your app will install in the registry. An the catch it for your path as

    Qt Code:
    1. LIBS += $$(MY_ENV_VAR)/my/path/to/MyDLL.dll
    To copy to clipboard, switch view to plain text mode 

    Hope it helps

  3. #3
    Join Date
    Jun 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Relative paths in Qt

    Thanks for the reply, but what I'm looking for is the Qt equivalent of C++ directive

    #import "..\..\MyDLL_Directory\MyDLL.dll"

    In such a way, if I move (at design time) the project pointing to MyDLL on another PC with the same tree structure but possibly different directories names, the linking works fine without modifying LIBS source code in .pro file. Also, avoiding to copy MyDLL file from its release folder into project directory, assure the project will point always to latest MyDLL version. In other words, there exists in Qt a syntax equivalent to C++ pattern "..\..\..\.." ?

Similar Threads

  1. X11 include and lib paths
    By Oluwafemi in forum Installation and Deployment
    Replies: 1
    Last Post: 3rd April 2010, 15:25
  2. include paths
    By altec in forum Installation and Deployment
    Replies: 0
    Last Post: 8th August 2008, 11:59
  3. Problems with paths
    By zorro68 in forum Installation and Deployment
    Replies: 1
    Last Post: 13th July 2008, 11:20
  4. qmake and visual studio paths
    By SiLiZiUMM in forum Installation and Deployment
    Replies: 1
    Last Post: 12th March 2008, 07:18
  5. How to set paths?
    By hoborg in forum Installation and Deployment
    Replies: 11
    Last Post: 24th February 2006, 19:08

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.