PDA

View Full Version : qmake and libraries question



bnilsson
28th June 2008, 16:23
Hi!

I have a problem including libraries into my project.
This is my .pro file:

################################################## ####################
# Automatically generated by qmake (2.01a) lˆ jun 28 15:48:05 2008
################################################## ####################

TEMPLATE = app
TARGET =
DEPENDPATH += . src ui
INCLUDEPATH += . src

# Input
HEADERS += src/hasp.h \
src/hasp_hl.h \
src/mainwindowimpl.h
FORMS += ui/mainwindow.ui
SOURCES += src/hasp.cpp \
src/main.cpp \
src/mainwindowimpl.cpp
LIBS += -L/Users/bnilsson/Qt/PAMS/lib -llibhasp_darwin.a


I do "qmake", and when I open the Xcode project, there is no libhasp_darwin.a in the project, and of course it does not link.

What am I doing wrong?
(Of course, the library is where it is supposed to be, I double checked)

I am using MacOSX 10.5.3, Qt4.4.

BN

jpn
28th June 2008, 16:43
What if you make it "-lhasp_darwin"?

bnilsson
28th June 2008, 17:20
What if you make it "-lhasp_darwin"?
I tried that, no difference.

However, it is solved.
It works if I write like this:

LIBS += /Users/bnilsson/Qt/PAMS/lib/libhasp_darwin.a

which is NOT compliant to what is written in the Assistant regarding qmake LIBS usage.
Assistant claims that unix syntax will work.
Same thing in WinXP, the following does not work:

LIBS += -L/hasplib -llibhasp_windows.lib

while this works:

LIBS += /hasplib/libhasp_windows.lib

I think the Assistant entry about qmake LIBS needs an update.

fullmetalcoder
28th June 2008, 19:25
The -l switch works for most compiler and the correct syntax is to OMIT the lib prefix and the file extension : the linker figures them out on its own. If you tried with proper -lmylib syntax then the problem probably comes from the path you gave. What is the linker output by the way?

bnilsson
28th June 2008, 19:30
Thanks a lot!
I simply did not know this convention, now I am much wiser.
I tried it and it works.

LIBS += -L/Users/bnilsson/Qt/PAMS/lib -lhasp_darwin