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. Qt-MSVC Project: How to use dynamic library and other third-party static lib in same proect
Forum Updated to NodeBB v4.3 + New Features

Qt-MSVC Project: How to use dynamic library and other third-party static lib in same proect

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 668 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.
  • Bruce.ZhangB Offline
    Bruce.ZhangB Offline
    Bruce.Zhang
    wrote on last edited by
    #1

    In my Qt-MSVC project, used many different libraries, some supply to me as a dynamic library, and other static libraries, and when I build the project: mismatch appears.

    I don't have the libraries' codes, so I couldn't rebuild. What can I do in this case?

    libxxx.lib(common.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in Helper.obj

    aha_1980A 1 Reply Last reply
    0
    • Bruce.ZhangB Bruce.Zhang

      In my Qt-MSVC project, used many different libraries, some supply to me as a dynamic library, and other static libraries, and when I build the project: mismatch appears.

      I don't have the libraries' codes, so I couldn't rebuild. What can I do in this case?

      libxxx.lib(common.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in Helper.obj

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @Bruce-Zhang,

      I don't think there's much we can help here. You not only have libraries requesting different C++ runtime libraries (MT vs. MD), but also release vs. debug versions (the small 'd').

      If you cannot compile the libs yourself, you'll have to request them from the respective vendors.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      3
      • Bruce.ZhangB Offline
        Bruce.ZhangB Offline
        Bruce.Zhang
        wrote on last edited by Bruce.Zhang
        #3

        @aha_1980
        Thanks for the reply, is it possible for dynamic lib and static lib with the same configuration of debug mode /release mode?

        JonBJ 1 Reply Last reply
        0
        • Bruce.ZhangB Bruce.Zhang

          @aha_1980
          Thanks for the reply, is it possible for dynamic lib and static lib with the same configuration of debug mode /release mode?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Bruce-Zhang
          While you await a better answer. I would say, I do not think so for your MSVC case. There is not much about this out there on the web. I agree with https://stackoverflow.com/a/2285450/489865, and the second comment there. You are trying to mix MSVC compiled with options /MT and /MD. Being C/C++, these use static & dynamic C runtime libraries respectively. I do not believe these will mix/work correctly: for example, they won't agree/use the same global variables in the C runtime.

          Having said that, I stand to be corrected, and it is certainly worth a test. Can you obtain a non-debug version of your dynamic library, i.e. compiled /MD instead of /MDd?

          Bruce.ZhangB 1 Reply Last reply
          2
          • JonBJ JonB

            @Bruce-Zhang
            While you await a better answer. I would say, I do not think so for your MSVC case. There is not much about this out there on the web. I agree with https://stackoverflow.com/a/2285450/489865, and the second comment there. You are trying to mix MSVC compiled with options /MT and /MD. Being C/C++, these use static & dynamic C runtime libraries respectively. I do not believe these will mix/work correctly: for example, they won't agree/use the same global variables in the C runtime.

            Having said that, I stand to be corrected, and it is certainly worth a test. Can you obtain a non-debug version of your dynamic library, i.e. compiled /MD instead of /MDd?

            Bruce.ZhangB Offline
            Bruce.ZhangB Offline
            Bruce.Zhang
            wrote on last edited by
            #5

            Thanks, @JonB , I'll have a try, and respond later.

            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