working away from visual

Alright i had a question about the Microsoft visual studio, i just finished a game the program and when i tried to play it on another computer it wouldn't play correctly even though i took the file straight from the final debug folder, so in total how does one take a program they made and use it on another computer that dose not have Microsoft visual studios installed on it?
First of all, do a Release build. You don't want to use the Debug version unless you are debugging because it contains a lot of unnecessary crap.

Secondly... there is a C++ runtime library that your program needs to link to. This library has the code for a lot of the stuff you are using (like cin, cout, any part of WinAPI, etc, etc).

MSVS has it's own C++ runtimes.. typically in DLLs called MSVCRxx.dll (where 'xx' is the version number.. MSVCR stands for "MicroSoft Visual C Runtime"). These dlls might be installed on the user's computer, but they might not be. If they aren't, and if you are trying to link to them... you will get errors and the program won't run.


So 2 options:

1) Install those files on the computer that is going to run the program
or
2) Build those files into your program itself so it does not rely on external dll files.



I prefer solution #2 for small projects. Having a bunch of DLL dependencies is something I hate -- and shared libs are a mess on Windows.


So what you probably want... is to link to the libs Statically. This will result in your EXE file being a little bigger, but it will run without those DLL files.

LONG STORY SHORT

1) In MSVS, right click on your project
2) Go to properties on the drop menu
3) In the property pages, find the 'C/C++' section in the bar on the left and expand it
4) Click on 'Code Generation'
5) Find the "Runtime Library" option. My default, it's probably to "Multi-threaded Debug DLL" for Debug, and "Multi-threaded DLL" for Release.
6) Change it to "Multi-threaded Debug" for Debug... and "Multi-threaded" for Release.
7) Hit OK
8) Rebuild.

Note again... you will not want to give the Debug exe to anyone. Build the Release version and give that to people. It'll be like 1/5th the size and will run faster.
Thank you so much it worked great now i just need to find a way to stop the command window from popping up every time i run the program
In your project settings, Expand the "Linker" section. Go to the "System" page.

Look at the "SubSystem" option. Change it to "Windows".
Note that if you follow Disch's last suggestion you may have to change the signature of main(), else the program won't link.
Topic archived. No new replies allowed.