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 669 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.
  • B Offline
    B Offline
    Bruce.Zhang
    wrote on 12 Oct 2020, 09:33 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

    A 1 Reply Last reply 12 Oct 2020, 10:43
    0
    • B Bruce.Zhang
      12 Oct 2020, 09:33

      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

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 12 Oct 2020, 10:43 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
      • B Offline
        B Offline
        Bruce.Zhang
        wrote on 13 Oct 2020, 05:13 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?

        J 1 Reply Last reply 13 Oct 2020, 07:27
        0
        • B Bruce.Zhang
          13 Oct 2020, 05:13

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

          J Offline
          J Offline
          JonB
          wrote on 13 Oct 2020, 07:27 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?

          B 1 Reply Last reply 13 Oct 2020, 07:49
          2
          • J JonB
            13 Oct 2020, 07:27

            @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?

            B Offline
            B Offline
            Bruce.Zhang
            wrote on 13 Oct 2020, 07:49 last edited by
            #5

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

            1 Reply Last reply
            0

            1/5

            12 Oct 2020, 09:33

            • Login

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