PDA

View Full Version : LIBS+= behaviour on Windows



Benne Gesserit
1st August 2008, 21:38
This must be a very newbie question ,but I m both confused and frustrated ,I have looked around for a while (escuse me if somewhere else there is a right answer forr my question) and didnt find an explanation .
It s simple : I want to add more library paths and more libraries to my makefile .What should I put after LIBS+= ? Well ,that sounds I little bit stupid . I mean : http://doc.trolltech.com/4.4/qmake-variable-reference.html#libs
should I add full paths to libraries ? If I do that ,the makefile generated looks like this : (just the interesting part)


-L"i:\Qt\4.4.0\lib" -lmingw32 -lqtmaind I:\MinGW\lib\libaclui.a -lQt3Supportd4 -lQtGuid4 -lQtCored4

If I do LIBS+= -L" I:\MinGW\lib\" (just to add a path) :


-L"i:\Qt\4.4.0\lib" -lmingw32 -lqtmaind -LI:\MinGW\lib -lQt3Supportd4 -lQtGuid4 -lQtCored4

Is that correct? Shouldnt it add " at the begin and end of the path? Can the path have spaces?This way it seems to work ,but it s not the way the documentation says it should be ,is it?
Ok ,lets sum up : I someone can tell mee the syntax of LIBS+= in .pro on windows I would really ,really apreciate it.

Thanks in advance.

jacek
2nd August 2008, 21:25
This way it seems to work ,but it s not the way the documentation says it should be ,is it?
Where does it say so?


You can use the Unix -l (library) and -L (library path) flags and qmake will do the correct thing with these libraries on Windows (namely this means passing the full path of the library to the linker).

Benne Gesserit
3rd August 2008, 15:11
Ok ,maybe I misunderstood the documentation .
But ,then ,is it fine if in the makefile qmake puts -Lpath instead of -L"path" ? And can the path have spaces? Probably I will be testing that tomorrow ,but just to make it clear and in case anyone finds the same doubts .

Benne Gesserit
4th August 2008, 09:21
Ok ,I think I got my answers .I have just been working with libpaths with spaces and I think the conclusion is : when you want to add a libpath with a space ,you ve got to do it like : -L "path" .
Note the space between the 'L' and the first " .Otherwise ,I think qmake will have problems with the " (placing them somewhere else or just erasing them) or with the spaces in the path .
Hope this helps someone else and saves some time .Maybe I am the only fool who has to spend some time wondering how to do such a thing .

wysota
4th August 2008, 10:35
"-Lpath with spaces" (with -L inside the quotes) would have also worked, I think.

Benne Gesserit
4th August 2008, 19:59
Yes ,you are right .At least it seems to work .But....I dont like it .It s confusing ,you always see -L"path" ,then you see "-Lpath"....seems to be a mistake .Anyway ,it s good to know it can be used that way,
Thank you very much.

wysota
4th August 2008, 21:51
No, "-Lpath" is correct because quotes surround the whole argument and that's the meaning of quotes - to build a parameter containing spaces you surround it with quotes, not that you surround spaces with quotes or surround parts of the argument containing spaces with quotes.