PDA

View Full Version : qmake absolute vs relative LIBS path



TheShow
6th November 2009, 17:50
Can relative paths be used in a qmake file when specifying LIBS, something like:


LIBS += -L./lib -lsomelib

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


LIBS += -LC:/TheProject/lib -lsomelib

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


LIBS += -LC:/someDir/TheProject/lib -lsomelib

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

rknowles
6th November 2009, 17:55
Exactly what problem do you get when you use relative paths? (I have used relative paths successfully on Unix and WIndows.)

TheShow
6th November 2009, 19:24
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.

rknowles
6th November 2009, 20:29
I don't see what's wrong from what you show. How about some more debugging stuff? Add this to your .pro:


QMAKE_PRE_LINK =+= "dir & dir lib & "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.)

rknowles
6th November 2009, 21:50
Previous should be the usual "+=", not "=+=".

plitex
9th September 2010, 10:25
Are you solved the problem? Could you tell me how? I'm having the same issue to share the project...

saa7_go
9th September 2010, 10:51
Can you show your .pro file, and list of libraries that you use?

blackrosezy
12th October 2010, 14:40
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