0

I am trying to build an application file in release mode in Visual Studio 2015. The issue is that I need to use the Multi-threaded DLL run time library option. When I create the application and try to run it on a different computer I get various missing dll errors like msvcp140.dll and vcsruntime.dll. Is there a way to create an application file such that it has everything it needs and can independently run on any computer.

DBB
  • 467
  • 9
  • 23
  • 1
    Either statically link or install the Visual Studio 2015 redistributable. You can create an installer with the redistributable as part of the package so you still have a single exe to install. – drescherjm May 02 '16 at 18:23
  • This question may help: http://stackoverflow.com/questions/36898212/c-transportation-of-executable-files#comment61360935_36898212 – drescherjm May 02 '16 at 18:26
  • I did download the Visual Studio 2015 redistributable. It solves the issue of the libraries but there is a new issue. every time I try to input something the console window just closes without running the program. Any ideas? – DBB May 02 '16 at 18:55
  • I expect that is because your program ended and you ran it from explorer. Windows will immediately close an executable when it ends. Run it from a `cmd.exe` window to see the output. – drescherjm May 02 '16 at 18:56
  • Thats not the issue as it is suppose to create a few files which never get created hence it doesn't end up running. – DBB May 02 '16 at 19:18
  • Is the output path writable? – drescherjm May 02 '16 at 19:25
  • Yes it is writable. Plus I tried running it as admin as well. – DBB May 02 '16 at 19:47
  • I believe its time for you to install Visual Studio 2015 to try to debug the problem. I say its unrelated to the original question about the runtime choice. – drescherjm May 02 '16 at 19:50
  • I see. thanks for your help. Just a quick follow up. So my system is windows 7 and the one I am trying to run on is windows 8. Do you think that can affect the application in some way? – DBB May 02 '16 at 22:36

2 Answers2

1

Under "Libraries" you should select "Debug Multithreaded (/libs:static /threads /dbglibs)" for all your libraries. All the needed dll's will now be linked to your application. The executable will be somewhat bigger, but the application should work on any windows computer. You can use this option for both the debug and the release version. Keep in mind though that you may still run into problems if you're creating your own dll's that depends on other external dll's (which they often or always do). I.e. in order to be safe; do not create your own dll's.

Nikkor
  • 11
  • 2
0

You have to keep dependencies beside the exe(compiled) file. for this job, you can copy them in the exe directory, or set environment variable. Additionally, I suggest using cross platforms libraries, such as QT.

Hamidreza
  • 81
  • 1
  • 6