Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Visual Studio 2012 Static/DLL Library Problem
Forum Update on Monday, May 27th 2025

Visual Studio 2012 Static/DLL Library Problem

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    garyvee
    wrote on last edited by
    #1

    I have a Qt application which was developed in Linux that I am porting to Windows. I have a couple of my own libraries which I hope to statically link in addition to some of my own Qt libraries which by default are compiled with /MD (dll) via a qmake created Makefile.

    I am getting wrapped around the axel with linker errors complaining that I am mixing LIBCMT.LIB and MSVCRT.LIB.

    Can anyone offer guidance on how I should use /MD versus /MT compiler flags? I know these are supposed to be linker flags but they appear to have some meaining when building libraries. Perhaps even objects - don't know.

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The short version is: don't mix them. These are the settings to link against the static or dynamic runtime. So all your libraries/application etc… must use the same flag.

      You can create a static lib using the dynamic runtime, nothing wrong with that.

      By default Qt uses the dynamic runtime

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        garyvee
        wrote on last edited by
        #3

        Thanks for the useful reply. I am working with corporate supplied statically linked libraries which were created with the /MTd flag. My only work-around when integrating these libraries is to use the .dll version.

        Can you explain what you mean by:

        "create static lib using the dynamic runtime"

        Thanks again.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Just that you can build a static library that uses the Microsoft dynamic runtime.

          So your library itself will be static but linked to the dynamic runtime.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved