Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Creation of .dll file using build option in Qt-Creator



  • Hi

    I have a project which has to create a .dll file when run in debug or release modes. But i see no .dll file is created, but it shows a .exe file created instead. Please help me out how to create a .dll file. Please tell me what is the mistake i'm making.

    Thank you in advance.

    • Sandeep


  • Post your .pro file.
    Generally speaking should be

    @TEMPLATE=lib
    CONFIG += dll@



  • Hi mcosta,

    Below is my .pro file.

    NAME = dll_example
    TEMPLATE = app
    CONFIG += console release
    CONFIG -= qt
    DEFINES += DIRECT_INCLUDE

    LIBS += jazznovoscreendatasource.lib

    #------------------------------------------------------

    datasource specific files

    SOURCES += main.cpp

    HEADERS += jazzport.h
    SOURCES += jazzport.cpp

    HEADERS += jazzstring.h
    SOURCES += jazzstring.cpp

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/ -ljazznovoscreendatasource
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/ -ljazznovoscreendatasourced
    else:unix: LIBS += -L$$PWD/ -ljazznovoscreendatasource

    INCLUDEPATH += $$PWD/
    DEPENDPATH += $$PWD/



  • Hi,

    how I said in the previous post, in your PRO file there isn't a TEMPLATE=lib.

    In your PRO youcreate an executable that link a library named jazznovoscreendatasource.

    What do you want instead?



  • Hi,

    ya thats all.. Thank you. It worked fine. It was able to give me a .dll file. But i face a major problem with the .dll created. In the newly created .dll file, there is no method getting exported. I am trying to export 2 functions to the dll. But in the created dll there are no functions getting exported. Any idea with this??


  • Lifetime Qt Champion

    Hi,

    Have a look at this "wiki":http://qt-project.org/wiki/How_to_create_a_library_with_Qt_and_use_it_in_an_application

    It should get you started.

    Hope it helps



  • just use:
    @
    TEMPLATE = lib
    @

    It will generate .dll under windows and .so under linux or other under other systems



  • [quote author="sandeepv" date="1368129995"]Hi,

    ya thats all.. Thank you. It worked fine. It was able to give me a .dll file. But i face a major problem with the .dll created. In the newly created .dll file, there is no method getting exported. I am trying to export 2 functions to the dll. But in the created dll there are no functions getting exported. Any idea with this??[/quote]

    Ive got the same problem, if you use visual studio compiler try to add this to the file you nedd to export the function:

    @#define DllExport __declspec( dllexport )@

    and add DllExport before any function you need to export (in the header).


Log in to reply