Results 1 to 3 of 3

Thread: Link a .dll library to a Qt project

  1. #1
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Link a .dll library to a Qt project

    Hi !

    I am actually working on a project which enables connection to a datalogger Campbell.
    Campbell provides a simplepb.dll to communicate with datalogger, and I would like to use it in my project.
    You can download it here.
    I put this dll and the header in a DLL directory located on C:

    I changed the .pro file into:
    Qt Code:
    1. INCLUDEPATH += C:/DLL
    2. LIBS += -LC:/DLL -lsimplepb -lcoralib3d
    To copy to clipboard, switch view to plain text mode 

    The header:
    Qt Code:
    1. #ifndef FUNCTIONS_H
    2. #define FUNCTIONS_H
    3.  
    4. #include "simplepb.h"
    5.  
    6. void test();
    7.  
    8. #endif // FUNCTIONS_H
    To copy to clipboard, switch view to plain text mode 

    The .cpp:
    Qt Code:
    1. #include "Functions.h"
    2.  
    3. void test()
    4. {
    5. OpenPort(1,9600); //Function of simplepb.dll
    6. }
    To copy to clipboard, switch view to plain text mode 

    After building with Mingw, I obtain every time the same error: ..\TestDll\Fonctions.cpp:5: erreur : undefined reference to `OpenPort@8'.

    If someone has an idea to fix it !

    TY

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Link a .dll library to a Qt project

    The dll is not enough.
    You need the *.lib file which holds the symbol information.
    If you don't have, you could use GetProcAdresss() with the function signatures you have in your header. (under windows).
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Link a .dll library to a Qt project

    Hi !

    Thanks for your help !

    It's working !!!!! I found the .lib and droped it in the same directory =D

    Thanks a lot !

Similar Threads

  1. FFTW library on Windows and link to Qt Project
    By maroua_ in forum Qt Programming
    Replies: 8
    Last Post: 13th May 2013, 09:28
  2. how to link library in Qt( like gcc -l command)
    By dzh1121 in forum Qt Programming
    Replies: 21
    Last Post: 18th June 2010, 08:32
  3. How to link library?
    By Macok in forum Qt Tools
    Replies: 1
    Last Post: 31st March 2009, 16:47
  4. Link against library on Mac OS
    By janus in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd March 2009, 11:10
  5. Link *.so library
    By allstar in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2007, 15:27

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.