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 - Making qt perform static linking of C++ runtime libraries?
Forum Updated to NodeBB v4.3 + New Features

Qt - Making qt perform static linking of C++ runtime libraries?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 6 Posters 24.6k 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.
  • M Offline
    M Offline
    maybnxtseasn
    wrote on last edited by
    #1

    I'm currently trying to force my Qt program, which i have made and compiled WITHIN MSVC2010, to compile the C++ dependencies( such as MSVCP100.dll ) statically within the QT program so i don't have to ensure my client has this C++ dll( and to prevent me from having the client install the C++ redistributable in order to get the correct DLL for using my application. I found online where i can simply change the following settings shown below in Qt to make the runtime libraries compile statically with my application. The problem is i have no idea where to go and what to do using microsoft visual studio 2010 in order to change these settings so i can recompile the qt application :( any help is greatly appreciated!

    // Settings i need to change to inform QT to imbed C++ RTL inside the qt compiled applications i make
    QMAKE_CFLAGS_RELEASE += /MT
    QMAKE_CXXFLAGS_RELEASE += /MT
    QMAKE_CFLAGS_DEBUG += /MTd
    QMAKE_CXXFLAGS_DEBUG += /MTd

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      There are numerous thread and wiki articles "how to build standalone Qt app for Windows":http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows. Please find the most appropriate for your case and follow the instruction.

      http://anavi.org/

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

        If you want to do those things, you MUST also have Qt build as staic lib. You can't only use the MS redistributables linked statically.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          bq. If you want to do those things, you MUST also have Qt build as staic lib. You can’t only use the MS redistributables linked statically.

          Sure you can... but Qt libs will still need shared MS libs... So, it's just doesn't make a sense linking app statically with MS libs and shared Qt libs...

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Scylla
            wrote on last edited by
            #5

            It makes a little sense, because you don't have to distribute the MS libs ;-)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              astodolski
              wrote on last edited by
              #6

              I may be missing something but to me it looks like the replies have been related to creating static libs to link to the target exe. I too am trying to resolve the OP's issue the way it was posted. That is, retain the shared library DLLs but link the run-time libraries to them. I don't know how to do that as it seems sort of unconventional.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AcerExtensa
                wrote on last edited by
                #7

                [quote author="astodolski" date="1363310054"]I may be missing something but to me it looks like the replies have been related to creating static libs to link to the target exe. I too am trying to resolve the OP's issue the way it was posted. That is, retain the shared library DLLs but link the run-time libraries to them. I don't know how to do that as it seems sort of unconventional.[/quote]

                You mean you would like to have Qt DLLs but without MSVC dependencies?
                It will not work, Qt supports only MD compilation and not the MT. Quick answer is: you can't compile Qt with MSVC statically compiled into Qt libs. it is because memory allocation for objects is done in different places in Qt(like in QtGUI, QtCore etc...) and this objects then shred between this libraries. MT compiles each DLL with own runtime/memory allocation procedure, you can't allocate memory in one DLL and destroy it in another...

                God is Real unless explicitly declared as Integer.

                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