Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt Static Build 'Runtime Mismatch' MSVC
Forum Updated to NodeBB v4.3 + New Features

Qt Static Build 'Runtime Mismatch' MSVC

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
12 Posts 2 Posters 4.9k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Contempt
    wrote on last edited by
    #1

    After a few different tries I followed this tutorial to statically compile Qt. The tutorial linked above seemed to work more than any other tutorial or attempt(s) I've had. I run into one issue with this tutorial though. Rather than getting unresolved externals etc I get 'RuntimeLibrary Mismatch'
    Exact errors

    Severity	Code	Description	Project	File	Line	Suppression State
    Error	LNK1319	1 mismatches detected	Uploader	C:\Users\Contempt\source\repos\Uploader\x64\Debug\Uploader.exe	1	
    Warning	LNK4098	defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library	Uploader	C:\Users\Contempt\source\repos\Uploader\Uploader\LIBCMTD.lib(initializers.obj)	1	
    Error	LNK2038	mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in App.obj	Uploader	C:\Users\Contempt\source\repos\Uploader\Uploader\qtmaind.lib(qtmain_win.obj)	1	
    
    

    Picture
    alt text

    Notes:
    Using MSVC 2017
    Qt 5.9

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

      Hi,

      You are trying to link libraries using two different runtime, that won't work. Either build everything linking to the static runtime or everything with the dynamic runtime but you can't mix both.

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

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You are trying to link libraries using two different runtime, that won't work. Either build everything linking to the static runtime or everything with the dynamic runtime but you can't mix both.

        C Offline
        C Offline
        Contempt
        wrote on last edited by
        #3

        @SGaist That's what I tried to do. I followed the tutorial linked above which is suppose to ready Qt to be statically compiled (Multi-Threaded), yet I still receive that error.

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

          Do you have any other dependency ?

          Did you cleanup everything from your project before starting to use your self-built Qt ?

          Did you try to build a default application with Qt Creator using your static Qt ?

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

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            Do you have any other dependency ?

            Did you cleanup everything from your project before starting to use your self-built Qt ?

            Did you try to build a default application with Qt Creator using your static Qt ?

            C Offline
            C Offline
            Contempt
            wrote on last edited by Contempt
            #5

            @SGaist No I am installing Qt Creator right now to test that, but I fresh installed Qt Source so I assume it is cleaned? No other dependencies.
            //Edit
            I can dynamically compile with my static build, yet when I change from MDd to MTd I get the RuntimeLib error. Is this a bad sign?

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

              Are you sure you are using your self-built Qt ?

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

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                Are you sure you are using your self-built Qt ?

                C Offline
                C Offline
                Contempt
                wrote on last edited by
                #7

                @SGaist Yes. I tried to use Qt creator to test, but it was crying about not finding CL (MSVC Compiler) and I couldn't be bothered to fix one error just to test another.

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Contempt
                  wrote on last edited by
                  #8

                  I really just need to know what file to change from MD to MT. I believe my build is statically compiled because it throws no (other) errors, but one file somewhere still says MD which prevents it from building.

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

                    When you build Qt statically, did you do any modification to use the static runtime ?

                    Otherwise, even if you build Qt statically, it uses 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

                    C 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      When you build Qt statically, did you do any modification to use the static runtime ?

                      Otherwise, even if you build Qt statically, it uses the dynamic runtime.

                      C Offline
                      C Offline
                      Contempt
                      wrote on last edited by
                      #10

                      @SGaist I believe so. I used configure.bat with static option and compiled with NMAKE. I did everything the tutorial said, but the tutorial was for an older (5.7) Version of Qt does this change anything? Is there an official Qt Static Compilation tutorial?

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Contempt
                        wrote on last edited by
                        #11

                        Turns out my Microsoft Visual Studio was using the wrong Qt version (Not my static one) after changing it to the right one I no longer get MT mis matches (in fact if I try to compile with MD I get mismatches :) ), but I now have 159 unresolved externals. Have I done something wrong?

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

                          What are these externals ?

                          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