Results 1 to 20 of 28

Thread: project with a dll and a testprog (doesn't compile)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    Thank you, it compiles fine now. But when i try to execute it, i get the following error:

    ./tester/tester: error while loading shared libraries: libcalina.so.1: cannot open shared object file: No such file or directory

    The lib is in
    ./bin/libcalina.so
    ./bin/libcalina.so.1
    ./bin/libcalina.so.1.0
    ./bin/libcalina.so.1.0.0

    The exe file
    ./tester/tester

    The same, if both the .so files and the tester (bin/exe) are in the same dir..

    lld on the tester (exe) shows
    Qt Code:
    1. linux-gate.so.1 => (0xffffe000)
    2. libcalina.so.1 => not found
    3. libQtXml.so.4 => /usr/lib/libQtXml.so.4 (0xb7f12000)
    4. ...
    To copy to clipboard, switch view to plain text mode 

    I know whats wrong, but i don't know, how to solve it..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    Quote Originally Posted by aMan View Post
    ./tester/tester: error while loading shared libraries: libcalina.so.1: cannot open shared object file: No such file or directory
    There are two solutions. Either you have to edit your /etc/ld.so.conf (or /etc/ls.so.conf.d/something) and run ldconfig as root or make LD_LIBRARY_PATH environment variable point to a directory where the library is.

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

    darkadept (30th August 2007)

  4. #3
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    thank you, it works..

  5. #4
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    Hi,
    I have still the same pro files, as posted above by fullmetalcoder, but now i'm on windows with vs2005.

    The lib is compiled fine and a dll is created. But when it comes to compile the tester program, i get an error like this (translated from german):
    link /LIBPATH:"c:\qt\lib" /NOLOGO /DEBUG /SUBSYSTEM:WINDOWS /incremental:no /OUT:"..\bin\tester.exe" @C:\DOKUME~1\damdam\LOKALE~1\Temp\nm817.tmp
    LINK : fatal error LNK1181: Input file "calina.lib" couldn't be opened.
    .
    NMAKE : fatal error U1077: ""C:\Programme\Microsoft Visual Studio 8\VC\BIN\link.EXE"": Return-Code "0x49d"
    Stop.
    NMAKE : fatal error U1077: ""C:\Programme\Microsoft Visual Studio 8\VC\BIN\nmake.exe"": Return-Code "0x2"
    Stop.
    NMAKE : fatal error U1077: "cd": Return-Code "0x2"
    Stop.
    I do compiling with qmake nmake and nothing else. Please help me..

  6. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    Open the project properties and under Linker look at:
    • General, and see if you have the directory of the lib file listed in "Additional library directories". If not, add it there.
    • Input, at "Additional Dependencies" and see if you have "calina.lib" listed there. Also, if it isn't there, add it yourself.

    EDIT: Well yes, as I can see from your post, you don't meet the conditions for the first point in the solution I have suggested.
    So do this, and see if you get any other errors. You shouldn't.

    Regards

  7. #6
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    I'm compiling on the command line, so I don't have a project file (only makefiles) and cannot open vs. And I don't have an lib file too (should have mentioned that), because I want dynamic linking..

    There should be an option in the pro file for fixing that, but i don't know it (it has to be in the pro file, because it must be platform independant..)

  8. #7
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    But that lib is just the import library used by the linker to link your application to the dll.
    So, even if you link dynamically, you will still need a ".lib" to map the functions in your program's import address table to the dll library.

    Try with DEPENDPATH qmake variable and set it to the path of the additional dependencies directories( your library).


    Regards

  9. #8
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    So how can i get the lib file?

    I've tried compiling the lib statically and a calina.lib was created, but the result of compiling the tester was static too.

    I've looked into the qt/lib directory. For instance QtGui has 9 files:
    QtGui4.dll
    QtGui4.exp
    QtGui4.lib
    QtGui.prl

    QtGuid4.dll
    QtGuid4.exp
    QtGuid4.lib
    QtGuid4.pdb
    QtGuid.prl

    I assume the d in the second list stands for debug, because there is also a pdb file (program debug file from vs). But there are still 4 files for one lib, in my project there is only one (calina.dll) created.

  10. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    It will be generated automatically...
    It is by default placed in Debug or Release, depending on which target you compile/.

    Regards

  11. #10
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    They aren't. In the debug/releas folders are only the moc_blabla.cpp, blabla.obj and calina.intermediate.manifest files.

  12. #11
    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: project with a dll and a testprog (doesn't compile)

    check out your destdir... the .lib (and maybe .exp whatsoever...) should be in the same dir as the .dll unless they fail to be created which you would see when compiling the lib.
    Current Qt projects : QCodeEdit, RotiDeCode

  13. #12
    Join Date
    Jul 2006
    Posts
    79
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project with a dll and a testprog (doesn't compile)

    I've looked into all directories, I've even tried to remove the target and destdir variables, but nmake always creates only the dll..

    Maybe I could post the project as an zip file and you look into it (if that isn't too much work)?

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
  •  
Qt is a trademark of The Qt Company.