Results 1 to 6 of 6

Thread: Library woes - can't be found

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Library woes - can't be found

    Still trying to get this external library working.
    Here is the pro file entry:
    Qt Code:
    1. LIBS += -L"C:\mingw\msys\1.0\home\wayne\tqsllib\lib"
    2. LIBS += -llibtqsllib
    To copy to clipboard, switch view to plain text mode 

    And here is the compile error message:
    c:/qt/2010.02.1/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -llibtqsllib

    And here is the line from the Makefile.Release:
    LIBS = -L'c:/Qt/2010.02.1/qt/lib' release/hrlogger_res.o -LC:\cpp\qt_projects\hrlogger_development\debug\bui ld\lib\qserialdevice\release -LC:\cpp\qt_projects\hrlogger_development\debug\bui ld\lib\qserialdevicewatcher\release -lqserialdevice -lqserialdevicewatcher -LC:\mingw\msys\1.0\home\wayne\tqsllib\lib -llibtqsllib -lQtHelp4 -lQtTest4 -lQtSql4 -lQtXml4 -lQtGui4 -lQtNetwork4 -lQtCore4

    And the system path variable includes the path to libtqsllib.a
    And I have verified the file is there, with that name.

    Any ideas?

  2. #2
    Join Date
    Nov 2010
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Library woes - can't be found

    I think that you do not need to put both lines in, it should just be

    Qt Code:
    1. LIBS += -L"C:\mingw\msys\1.0\home\wayne\tqsllib\lib" -ltqsllib
    To copy to clipboard, switch view to plain text mode 

    and you do not need to add the lib before the library name as the -L tells the compiler it is a library.

  3. The following user says thank you to gowen for this useful post:

    waynew (23rd November 2010)

  4. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Library woes - can't be found

    Well, that is the library file name, libtqsllib.a

    After reading some other posts, I changed my pro file entry as a test, to:
    LIBS += "C:\mingw\msys\1.0\home\wayne\tqsllib\lib\libtqsll ib.a"

    Now it compiles without error, but I don't think the library is being included because it fails on the first library call with:
    ./release/lotwupload.o:lotwupload.cpp::-1: error: undefined reference to `_imp__tqsl_init@0'

    tqsl_init() is the first function called in the library.

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Library woes - can't be found

    When you say "compiles without error" do you mean compiles and links without error but produces a error message at run time, or is that message coming from the linker (i.e. after the compile stage but not at run time).

    If tqsllib is a dynamic library the the corresponding DLL must be available in the program directory or on the system PATH of the executing process. Getting this wrong will cause a run time error.

    The .a file must be locatable during linking in a standard location (compiler dependent), in a location specified by a -L path, or in an explicitly identified location. When searching the built in or user paths the name specified by -lname will have "lib" prepended and ".a" appended (as gowen pointed out). The libtqsllib.a file does not need to be in the system PATH or available at run time. Getting this wrong will cause a linker error.

  6. The following user says thank you to ChrisW67 for this useful post:

    waynew (23rd November 2010)

  7. #5
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Library woes - can't be found

    I get no build issues, the only error is at run time whne my Qt application tries to access a library function.

    I compiled the library from source using mingw/msys with the option --disable-shared so being new to libraries, I am assuming it is static.
    The compile output produced both files libtqsllib.a and tqsllib2.dll

    What makes me wonder whether the library is being included or not is commenting out the LIBS =+ line in my pro file does not change the size of my Qt application executable that is produced. If not, that would account for the run time error.
    How can I tell for sure if the library is being included?

    What am I doing wrong here?

  8. #6
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Library woes - can't be found

    Have changed my pro file entry to : LIBS += -L"C:\mingw\msys\1.0\home\wayne\tqsllib\lib" -ltqsllib
    No build errors.
    But when I add the code for the first library function I need:
    int ret = tqsl_init();

    I get the error at linking:
    E:\CPP\QT_Projects\HRLogger_Development/lotwupload.cpp:23: undefined reference to `_imp__tqsl_init@0'

    But when I change the pro file to:
    LIBS += -L"E:\mingw\msys\1.0\home\wayne\tqsllib\bin" -ltqsllib2
    It appears to compile and link ok.
    But at run time, the application crashes before the main window opens.
    Last edited by waynew; 24th November 2010 at 00:05.

Similar Threads

  1. Replies: 5
    Last Post: 18th June 2010, 21:13
  2. Replies: 4
    Last Post: 20th May 2009, 10:20
  3. More SQLite Woes and onFocus Woes
    By morraine in forum Newbie
    Replies: 1
    Last Post: 13th August 2008, 13:14
  4. SQLite Woes
    By morraine in forum Newbie
    Replies: 5
    Last Post: 12th August 2008, 19:27
  5. Plugin woes
    By stevey in forum Qt Programming
    Replies: 8
    Last Post: 24th July 2006, 01:30

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.