How do I use functions in a 3rd party .DLL file in Qt Creator on Windows?

  • I've set the .DLL location in the windows environment variable path. I'm trying to do #Include <DLLname> which is not working. I'm very new, so sorry if this is a stupid question but thank you for any help!

  • Moderators

    I guess you would like to use the dll in an application you are working on?

    If you have access only to the dll and not the source, you need to have at least access to the interface. So, typically 3rd party dlls are coming as <3rd party>.dll with an additional lib <3rd party>.lib and a header file (<3rd party>.h). You need to include the header file in your application.

    You need to add the INCLUDEPATH to your .pro of the project. For example, when you have all stuff in one folder c:/bla/bli/3rdparty, you can add in the .pro
    INCLUDEPATH += c:/bla/bli/3rdparty

    When you have the header c:/bla/bli/3rdparty/3rdparty.h you can than use in your application:
    #include "3rdparty.h"

    You probably need also to set the LIBS parameter in .pro:
    LIBS += -Lc:/bla/bli/3rdparty -l3rdparty.lib
    when the lib is c:/bla/bli/3rdparty/3rdparty.lib.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.