-2

So i'm fairly new to VS and coding and I've recently made a small snake game in a C++ console application project, which works fine but i would like to get it to work on another PC without VS. The closest i have found to answering my question were these other StackOverflow questions here and here. i have installed the vs installer projects extension to try make it a setup project and include the required dependencies but i cant work out how to do this. Does anyone have any info to guide me through my last step of this problem or am i completely on the wrong track?

Community
  • 1
  • 1
Max Co
  • 1

2 Answers2

0

If the application uses dynamic runtime (which is the default), it uses the VS DLL files. To provide them, the Visual Studio Runtime Redistributable for that particular VS version needs to be installed on the target machine (as mentioned in your second link).

So that means you need to setup the installer that way. I didn't use it, but there might be some options that the resulting setup can either contain or download and install the VS redistributable automatically.

See also here: How to install redistributable with visual studio setup? (but it is for VS 2013, there might be some changes in 2015)

Community
  • 1
  • 1
EmDroid
  • 5,918
  • 18
  • 18
  • Unless the application links against the [Universal CRT](https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx), which is a Windows component. – IInspectable Oct 26 '16 at 22:49
  • ill look into this now and see if it helps me figure out how to setup the installer. thanks – Max Co Oct 27 '16 at 15:46
0

Well, you don't tell us what kind of project your C++ console app is...

Using only C++, your app can be built with different versions of the CRT, like for instance:

  • V120 (VS-2013)
  • V120_XP (VS-2013 w/ XP support)
  • V140 (VS-2015)
  • V140_XP (VS-2015 w/ XP support)

Even on VS 2015, you can choose the version of the CRT you want, and use an older version, if needed.

Anyway, the target computer will need the DLLs for the correct CRT version.
Microsoft provides them. You can either ship them with your product, if you have a custom installer, or use the installer provided by Microsoft.

MSDN - Determining Which DLLs to Redistribute

For instance, using V120:

  • msvcp120.dll
  • msvcr120.dll

Your project might also use .NET.
In such a case, you also need to install the correct version in the host machine.

Macmade
  • 52,708
  • 13
  • 106
  • 123
  • There is no CLR in a C++ application. – IInspectable Oct 26 '16 at 22:50
  • sorry like i said i'm fairly new to this. when i started the project i selected win32 console application. i was not aware i could choose a different CRT versions. i'm using dependency walker which tells me its MSVCP140D.dll, VCRUNTIME140D.dll,UCRTBASED.dll and KERNAL32.dll. i admit i'm struggling to make a setup file or an installer to make it as user friendly installing on target PC. – Max Co Oct 27 '16 at 15:44
  • @MaxCo: You must not ship the debug versions of the CRT (msvcp140d.dll, vcruntime140d.dll, ucrtbased.dll). Those are part of Visual Studio, and no distributable. I don't know what *"KERNAL32.dll"* is. At any rate, don't rely on Dependency Walker too much. It used to be a fine tool until it stopped being serviced years ago. – IInspectable Oct 27 '16 at 21:04