Using a dll in a qt application program

user3627590

Everybody, I am a beginner and I have still have some things I am confusing about.

I have a program qt which I want to include a extern library. Generaly, to include a extern library I use the macros :

INCLUDEPATH += "path/to/the/include/headers/file"
LIBS += -L"path/to/where/the/lib/are" \
        -llibname   // .a for gcc .lib for mscv

Then I can use the library in my program. But at the end the qt aplication program use the .dll associated to the lib name. So my question, why can't we use directly the .dll in Qt ? I don't know very much the difference between a ".lib" and ".dll" execpt a ".dll" is used at the runtime.

My problemen is have a library with only the dll and the include headers file. Is there a way to use this library like this or I must have the .a or .lib associated ?

EDIT : Ok now,thanks to the useful advice, I understand better the difference between, .lib and .dll and how to use a dll without a .lib with only header. But I am having a issue. With the header, I can create the object, the compilator doesn't bother about it can't find the object and its method, but When I compile, I have some problems about "undefined reference to a method".

If I correctly understand, the reference cannot be found because the reference are defined in the .lib, that's why it can't find it. So my question :

How can I say to the compilator that the reference to a method will be defined at runtime and not at compile time ?

EDIT2 : Ok so apparently you can get a pointer of an object with a dll but you can't use its methods, so I think I am facing the wrong way. Thanks again for you answer.

Best regards,

so61pi

There are 2 types of lib file, see this asnwer: https://stackoverflow.com/a/2375144/2064646

You can just use a .dll without .lib file, but through GetProcAddress function.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using KDE System Theme in Pure Qt Application

From Dev

Qt Application Calling Dll from Fortran

From Dev

Using CUDA in a DLL with a C# Application

From Dev

Using a Qt library from a C program

From Dev

using Qt in non GUI application, pros and cons?

From Dev

Stop working program with QcustomPlot basic code in QT application (VS plugin)

From Dev

Qt application crashes when using DLL, works fine if exported function doesn't declare APIENTRY

From Dev

Event Loop in Qt-based DLL in a non-Qt application

From Dev

Qt5Qmld.dll missing: could not start the simple qt application because Qt5Qmld.dll is missing

From Dev

Using the closeEvent in a qt application does not close it

From Dev

Build Qt application for Linux in Windows using Qt Creator

From Dev

using dll library in android application

From Dev

Create & Using Dll's On MFC Application

From Dev

How to auto restart a Qt application when it crashes, within the same program?

From Dev

Using Qt codes in Android application

From Dev

Qt Application Calling Dll from Fortran

From Dev

Using CUDA in a DLL with a C# Application

From Dev

Using theme for my Qt widget application

From Dev

Application is null when using it in my dll

From Dev

Using Qt Creator and OpenCV to make a simple program

From Dev

Compiling standalone Qt application using MinGW

From Dev

Qt using .dll in .dll

From Dev

Create & Using Dll's On MFC Application

From Dev

Video Streaming on Qt Linux application using RTP

From Dev

How to auto restart a Qt application when it crashes, within the same program?

From Dev

osX - How to Start Another Program from my QT Application

From Dev

Extensible application using Qt

From Dev

How can I open a pdf with a relative path using the default application in a Qt program

From Dev

Dll loaded by application only in qt debugger but not independently

Related Related

  1. 1

    Using KDE System Theme in Pure Qt Application

  2. 2

    Qt Application Calling Dll from Fortran

  3. 3

    Using CUDA in a DLL with a C# Application

  4. 4

    Using a Qt library from a C program

  5. 5

    using Qt in non GUI application, pros and cons?

  6. 6

    Stop working program with QcustomPlot basic code in QT application (VS plugin)

  7. 7

    Qt application crashes when using DLL, works fine if exported function doesn't declare APIENTRY

  8. 8

    Event Loop in Qt-based DLL in a non-Qt application

  9. 9

    Qt5Qmld.dll missing: could not start the simple qt application because Qt5Qmld.dll is missing

  10. 10

    Using the closeEvent in a qt application does not close it

  11. 11

    Build Qt application for Linux in Windows using Qt Creator

  12. 12

    using dll library in android application

  13. 13

    Create & Using Dll's On MFC Application

  14. 14

    How to auto restart a Qt application when it crashes, within the same program?

  15. 15

    Using Qt codes in Android application

  16. 16

    Qt Application Calling Dll from Fortran

  17. 17

    Using CUDA in a DLL with a C# Application

  18. 18

    Using theme for my Qt widget application

  19. 19

    Application is null when using it in my dll

  20. 20

    Using Qt Creator and OpenCV to make a simple program

  21. 21

    Compiling standalone Qt application using MinGW

  22. 22

    Qt using .dll in .dll

  23. 23

    Create & Using Dll's On MFC Application

  24. 24

    Video Streaming on Qt Linux application using RTP

  25. 25

    How to auto restart a Qt application when it crashes, within the same program?

  26. 26

    osX - How to Start Another Program from my QT Application

  27. 27

    Extensible application using Qt

  28. 28

    How can I open a pdf with a relative path using the default application in a Qt program

  29. 29

    Dll loaded by application only in qt debugger but not independently

HotTag

Archive