Results 1 to 5 of 5

Thread: qmake and libraries question

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default qmake and libraries question

    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
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: qmake and libraries question

    What if you make it "-lhasp_darwin"?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qmake and libraries question

    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.
    MacOSX user dabbling with Linux and Windows.

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake and libraries question

    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?
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #5
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qmake and libraries question

    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
    MacOSX user dabbling with Linux and Windows.

Similar Threads

  1. MacOS settings
    By skaiser in forum Installation and Deployment
    Replies: 2
    Last Post: 19th July 2007, 07:47
  2. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  3. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  4. Setting up qmake to run "Hello World"
    By Rolsch in forum Newbie
    Replies: 2
    Last Post: 27th May 2006, 02:37

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.