Home > Blockchain >  How to build a Qt C application that doesn't need VC Redistributables on a pc to run
How to build a Qt C application that doesn't need VC Redistributables on a pc to run

Time:11-22

I am building an application using Qt C and I want it to run on windows computers without having to install VC Redistributables. Apparently when user tries to run the application an error pops that says that VCRUNTIME140.dll is missing.

CodePudding user response:

Build both Qt and your application using compiler option /MT?

https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170

CodePudding user response:

I recommend using GCC (i.e. MinGW) as the compiler. If you do that, your app will generall depend on the msvcrt.dll that comes with Windows and doesn't need to be installed specially (but it depends on exactly how the GCC compiler is configured). It will also possibly depend on some GCC runtime library DLLs that you can just put in the same directory as your EXE.

MSYS2 is a good development environment for using MinGW on Windows: https://msys2.org

I also made a useful set of tools that is capable of cross-compiling statically-linked MinGW/Qt applications from Linux: https://github.com/DavidEGrayson/nixcrpkgs

The Qt applications I build with nixcrpkgs come out as single, standalone EXEs that do not need to be shipped with any DLLs.

  • Related