Important: Please read the Qt Code of Conduct -

Definition file with qt

  • Hello,
    I migrate a C++ program to Qt(mingw). The program is a library (dll) generated by QT.
    Before using Qt , i create three file : .dll,.a,.def.
    How could i still create the definition file with Qt? What change i have to do in my pro file.

    Thanks in advance

    Ps: I know the command in gcc is "--output-def,xxx.def"

  • Hi and welcome to devnet

    The general question is if your dll is using Qt functionality?

    What you might perceive as Qt consists of different components.
    Initially and it still is, Qt names a set of library functions for GUI and non-GUI applications.
    In the mean time typical installation have also the added functionality of an Integrated Development Environment (IDE). This is IDE is Qt creator. There are other tools which iam leaving out here.

    You can continue to develop any application or dll with the Qt creator. You can also start a new development with Qt creator, but there is no requirement that your application is using functionality of Qt libs.

    It reads like you have an existing dll project, but you do not intend to use functionality of Qt. That is absolutely fine.
    The question is how you compiled your dll project before. Many external tools are also supported by Qt creator.

    Alternatively, you can also checkout and create a new test project for a dll. Go to "new project" -> "Libraries" -> "C++-Library". There are different options you can choose. When gone through this procedure, you will probably see what to do to continue your development.

  • @koahnig said:

    external tools

    HI thanks for welcoming,
    The reason i migrate is to use Qt functionnality.
    For creating the dll , i already done it by using "new project" -> "Libraries" -> "C++-Library" and that's work fine :).

    The only problem i have is created the definition file (xxx.def). And i really don't see in qt how to do this.

    Before using qt, I used to write myself makefile(gcc) and compile with gcc under mingw environnement .The specific command to create def file was this :
    "g++ -Wall yyy.o -o xxx.dll -s -shared xxx.o -Wl,--subsystem,windows,--output-def, xxx.def"

  • @beranger
    Apparently you can use a the DEF_FILE statement in your .pro file. Unfortunately, the description is not detailed.
    I have found another old thread.

  • @koahnig
    Thanks for the help and link.
    Finally, i have done it by adding this line in pro :
    QMAKE_LFLAGS += -Wl,--output-def,release/cc_shared_memory.def

  • @beranger
    Glad to see that you have solved your problem.
    At the button after the last post you see the "Topic Tools". Please open it and mark your post as solved.