Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build applications for both Windows 7 and Windows 10 with Visual Studio 2015

I've built an application that makes use of C++11 features and the winsocket. I built the application using windows 10 and the Visual C++ 2015 compiler. On the Win10 machine it runs fine. On a Win7 machine a popup shows up, stating that the file ucrtbase.dll is missing.

I've done a little research on the web and found out that Microsoft did quite a big change to the CRT and thus renamed some dlls. These dlls are not available per se on Win7.

Is there a way to build my application independant from this libraries? I'd like to ship the application to both Win7 and Win10 users.

Thank you

like image 832
Soccertrash Avatar asked Jul 26 '16 06:07

Soccertrash


1 Answers

As the comment on your question says, you can statically link the CRT by using the /MT flag in project's Configuration Properties -> C/C++ -> Code Generation -> Runtime Library setting.

If this is not an option for your project, you can install the CRT redistributables instead.

In C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\1033 you will find three files:

  • vcredist_arm.exe
  • vcredist_x64.exe
  • vcredist_x86.exe

These are packages containing the CRT for this version of Visual Studio, designed to be installed on machines that need to run your software.

Install the appropriate redistributable on the target system prior to running your application. For example, if your application is 32bit, install vcredist_x86.exe. For 64bit, install vcredist_x64.exe.

Generally when you create an installer for your software you bundle these files too, and run them during the install process.

like image 96
badgerr Avatar answered Oct 09 '22 12:10

badgerr