9

How can I stop Qt from renaming my DLL to MyDLLName{MAJOR_VERSION_NUM}.dll?

This only happens when I set the VERSION in my project file, but I also want to set the version. For example, if I have:

VERSION = 1.2.3.4

And my library is named MyDll, it will create my DLL in the debug folder as MyDLL1.dll. If I take the version number away, it keeps the name as I want it (MyDLL.dll).

Thanks.

hetelek
  • 3,776
  • 5
  • 35
  • 56
  • 1
    Possible duplicate of [Why library name gets an additional 0 in its name?](http://stackoverflow.com/questions/404774/why-library-name-gets-an-additional-0-in-its-name) – Alexander Dyagilev Dec 26 '15 at 10:25
  • Also you can use this solution: http://stackoverflow.com/a/42269750/1536843 – iamantony Feb 16 '17 at 09:29

2 Answers2

14

Use this:

CONFIG += skip_target_version_ext
Alexander Dyagilev
  • 1,139
  • 1
  • 15
  • 43
6

See this answer (on SO) for why it is there: Why library name gets an additional 0 in its name?

You can "not-set" the version to remove it from the generated name, but are you sure you want to do that? (It's there to avoid DLL Hell.)

The "proper-answer" is that the LIB template is adding the version number.

Also, note:

  • VERSION is used to define VER_MAJ and VER_MIN
  • msvc_nmake generator adds /VERSION:major.minor to link flags if !empty
  • msvc_vcproj generate adds /VERSION:major.minor to link flags and MSVCPROJ_VERSION if !empty

You can explicitly set those yourself, or "unset" any of them.

You can explicitly remove the version number from the target name with the TARGET_EXT variable, for example, see: http://qt-project.org/faq/answer/how_can_i_add_version_information_to_my_application

If you want to create your own plugin to decide how to generate the target name (without the version number), you can make your own plugin as described in this answer (on SO): How to avoid having version numbers in .so file name

Community
  • 1
  • 1
charley
  • 5,913
  • 1
  • 33
  • 58
  • It is usefull to be removed when using minGW + Cygwin, because generating file links from .so.1.2.3 to .so does not work in windows. – Tomas Kubes May 12 '14 at 15:25
  • 1
    Giving each version a new file name is not practical. The file name is explicitly referenced in the Installer builder, and when called by the EXE. Changing the source each time is too troublesome. – Pierre Apr 15 '21 at 20:42