PDA

View Full Version : How to use a library (LAPACK) with Qt? (Windows)



Skywalker
2nd January 2009, 02:34
This is a real beginner question - I've never used Qt on Windows before. I want to use the LAPACK library with Qt. I've placed "LIBS += -llapack" in my .pro file, but how do I get Qt to know where the LAPACK library is located?

I have Vista 64.

conrad10781
2nd January 2009, 14:27
Assuming that the library name is right... You don't have to do anything if the library is in your windows PATH. Otherwise you will have to use -L to tell Qt where it is located

giusepped
2nd January 2009, 15:04
You have to set the DEPENDPATH and the INCLUDEPATH in your .pro.

Skywalker
4th January 2009, 23:46
Thanks. I installed LAPACK for Windows (http://icl.cs.utk.edu/lapack-for-windows/), and have the text below as part of my .pro file. But the compiler still can't find -llapack. What's my mistake?

DEPENDPATH += .
DEPENDPATH += C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\lib\x64
INCLUDEPATH += .
INCLUDEPATH += C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\lib\x64

jpn
5th January 2009, 08:42
Try something like this:


INCLUDEPATH += "C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\include
LIBS += -L"C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\lib\x64" -llapack

Skywalker
5th January 2009, 19:54
Thank you very much, that worked.

Is there a way to conditionally include that in the .pro file, so that the same .pro file would work on both Windows (where those includes are necessary) and Linux (where a simple -llapack works)?

rexi
5th January 2009, 20:05
Yes, by using scopes. See the qmake manual (http://doc.trolltech.com/4.4/qmake-advanced-usage.html#scopes).

Basically, add this to your .pro file:


win32 {
INCLUDEPATH += "C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\include
LIBS += -L"C:\Program Files (x86)\University Of Tennessee\LAPACK 3.1.1\lib\x64" -llapack
}

Skywalker
5th January 2009, 20:31
Thanks a lot for the help :)