Results 1 to 8 of 8

Thread: qmake absolute vs relative LIBS path

  1. #1
    Join Date
    Oct 2009
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default qmake absolute vs relative LIBS path

    Can relative paths be used in a qmake file when specifying LIBS, something like:

    Qt Code:
    1. LIBS += -L./lib -lsomelib
    To copy to clipboard, switch view to plain text mode 

    We are developing a project and placing the .pro file into source control. The problem is that we have only been able to use absolute paths, as in

    Qt Code:
    1. LIBS += -LC:/TheProject/lib -lsomelib
    To copy to clipboard, switch view to plain text mode 

    but another developer might have checked out the project to a different location, for example

    Qt Code:
    1. LIBS += -LC:/someDir/TheProject/lib -lsomelib
    To copy to clipboard, switch view to plain text mode 

    Is there anyway to avoid this conflict so we don't always have to change this line when building?

  2. #2
    Join Date
    Jun 2007
    Location
    Massachusetts, USA
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake absolute vs relative LIBS path

    Exactly what problem do you get when you use relative paths? (I have used relative paths successfully on Unix and WIndows.)

  3. #3
    Join Date
    Oct 2009
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qmake absolute vs relative LIBS path

    This is the linking error:

    C:\Qt\2009.04\mingw\bin\..\lib\gcc\mingw32\3.4.5\. .\..\..\..\mingw32\bin\ld.exe: cannot find -llibfftw3-3
    collect2: ld returned 1 exit status
    In my project, there is a .pro file and a subdirectory named lib that contains all the DLL's required for the project. If a full path is specified, it works, but I've been unable to use any form of a relative path.

    None of these have worked:
    LIBS += -Llib -llibfftw3-3
    LIBS += -L./lib -llibfftw3-3
    LIBS += -L".\lib" -llibfftw3-3

    but LIBS += -LC:/TheProject/lib -libfftw3-3 works like a charm.

  4. #4
    Join Date
    Jun 2007
    Location
    Massachusetts, USA
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake absolute vs relative LIBS path

    I don't see what's wrong from what you show. How about some more debugging stuff? Add this to your .pro:

    Qt Code:
    1. QMAKE_PRE_LINK =+= "dir & dir lib & "
    To copy to clipboard, switch view to plain text mode 
    and then show us the results of those "dir" commands and the full text of the link command that is failing. (This should be right after the "dir"s.)

  5. #5
    Join Date
    Jun 2007
    Location
    Massachusetts, USA
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake absolute vs relative LIBS path

    Previous should be the usual "+=", not "=+=".

  6. #6
    Join Date
    May 2007
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake absolute vs relative LIBS path

    Are you solved the problem? Could you tell me how? I'm having the same issue to share the project...

  7. #7
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: qmake absolute vs relative LIBS path

    Can you show your .pro file, and list of libraries that you use?

  8. #8

    Default Re: qmake absolute vs relative LIBS path

    simple, here is using absolute path :

    LIBS += -L"E:\PROJECT\C++\QT\Sample\Curl\lib" -lcurldll

    and here is using relative path :

    LIBS += -L$$PWD\lib -lcurldll

Similar Threads

  1. qmake LIBS missing quotes
    By redoctober0 in forum General Programming
    Replies: 1
    Last Post: 12th January 2011, 16:05
  2. Replies: 8
    Last Post: 17th October 2009, 08:10
  3. Plugin LIBS path not found
    By vieraci in forum Qt Programming
    Replies: 7
    Last Post: 5th August 2009, 14:32
  4. Where does qmake get the qt path?
    By reimer in forum Installation and Deployment
    Replies: 6
    Last Post: 2nd August 2008, 07:54
  5. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

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.