Results 1 to 9 of 9

Thread: Program won't run with library

  1. #1
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Program won't run with library

    I have a Qt program that needs to use two C libraries. One of them I can call functions from and it works fine. The other one, when I add a call to a function in that library, the program won't run in the ide. The process stub window comes up with no qDebug output and the application does not run. Both library files are dlls - I am running under Windows. Both libraries look ok in dependency checker.
    They are both set up the same way in the pro file.

    Qt Code:
    1. DEPENDPATH += C:/development/QT_Projects/HRLogger_Dev_Spots/debug/Hamlib
    2. INCLUDEPATH += C:/development/QT_Projects/HRLogger_Dev_Spots/debug/Hamlib
    3. LIBS += -L"C:/development/QT_Projects/HRLogger_Dev_Spots/debug/Hamlib"
    4. LIBS += -llibhamlib
    5.  
    6.  
    7. DEPENDPATH += "C:/development/qt_projects/hrlogger_dev_spots/debug/tqsllib/include"
    8. INCLUDEPATH += "C:/development/qt_projects/hrlogger_dev_spots/debug/tqsllib/include"
    9. LIBS += -L"C:/development/QT_Projects/HRLogger_Dev_Spots/debug/tqsllib/lib"
    10. LIBS += -ltqsllib2
    To copy to clipboard, switch view to plain text mode 

    Headers for both libraries are included:
    Qt Code:
    1. extern "C"
    2. {
    3. #include "tqsllib.h"
    4. #include "tqslerrno.h"
    5. #include "tqslconvert.h"
    6. #include "adif.h"
    7. }
    8. extern "C" {
    9. #include "rig.h"
    10. #include "rig_dll.h"
    11. #include "riglist.h"
    12. #include "rigclass.h"
    13. #include "rotator.h"
    14. #include "rotlist.h"
    15. }
    To copy to clipboard, switch view to plain text mode 

    libhamlib works fine with my program. tqsllib2 causes it not to run. Makes no difference where in my program I put a call to a function in tqsllib2, even though that code is not executed at startup, my application fails to run. This happens with either the tqsllib I compiled using gcc, or the tqsllib file that is supplied with the windows application that uses the library.

    Probably some simple explanation but I can't see it.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Program won't run with library

    Please define "don't run" and "fail to run". Do you get any errors? Where are the libraries located? Can the main executable see them both?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program won't run with library

    Wysota - I'm probably not using the correct terms. What I mean is that when I put in a function call to the tqsllib, the main window fails to open when I run the application. The libraries are located in directories below the debug directory (see .pro code in first post)

    With no function call, the main window opens and the console looks like this:
    normal.jpg
    With the function call, the main window fails to open and the console looks like this:
    failure.jpg

    Hope the images show up.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Program won't run with library

    Quote Originally Posted by K4ELO View Post
    the main window fails to open when I run the application.
    You mean the application continues to run but there is no window open?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program won't run with library

    The window does not open and the Application Output says the program exited with code 0.

  6. #6
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program won't run with library

    Quote Originally Posted by K4ELO View Post
    Wysota - I'm probably not using the correct terms. What I mean is that when I put in a function call to the tqsllib, the main window fails to open when I run the application. The libraries are located in directories below the debug directory (see .pro code in first post)
    is that the same location as the debug app exe? Since the libs are in different places, how can the app see the dlls at run time?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Program won't run with library

    Quote Originally Posted by K4ELO View Post
    The window does not open and the Application Output says the program exited with code 0.
    If you modify your main() function so that at the beginning it prints some text and before returning it prints some more text, do you get the textual output? If not then your program was never running and the problem is not that a window fails to open but rather that your program fails to run (probably because of missing libraries). I don't know what you checked in the dependency checker and how you checked it but apparently your check was invalid. Try running your program by double-clicking its icon and see if you get any useful response from Windows (e.g. about the program failing to start because of missing libraries).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Nov 2012
    Location
    Kentucky, USA
    Posts
    46
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Program won't run with library

    no text output Wysota. Tried double clicking the exe and I get the same response, no output. When I run the dependency checker on my exe, both libraries show up, however, in the hamlib, it lists all of the library functions, but in tqsllib, it only lists one, tqsl_init(), but there should be many. Maybe this library file is corrupt?

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Program won't run with library

    Quote Originally Posted by K4ELO View Post
    I get the same response
    I'm not a trueseer. I don't know what "the same response" is.
    Maybe this library file is corrupt?
    No idea. Left my crystal ball in the other pants.

    In general, if there is something wrong with starting the program from file explorer, Windows should pop up a dialog stating what the problem is (more or less). If it doesn't display anything then there is a chance your program executes but we have no way of knowing that as you didn't provide any useful source code to look at.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 20th December 2012, 13:48
  2. Can I link shared library in static build program?
    By berlinud in forum Installation and Deployment
    Replies: 1
    Last Post: 27th August 2010, 17:36
  3. Replies: 0
    Last Post: 20th July 2010, 15:30
  4. Qt/windows: how to compile program with audiere library
    By punjabikura in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2009, 16:09
  5. Building qt program with static library
    By JonathanForQT4 in forum Newbie
    Replies: 2
    Last Post: 23rd June 2007, 00:15

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.