I was wondering how to make a c/c++ program installable on other computers. For example, lets say for some odd reason a friend wanted a hello world program. Obviously, if I complie the code it will only run on my computer. The may be a noobish question, but we still haven't learned about it in school and if we ask the professors, we get the "that is beyond the scope of this course" response. Thanks for the help.

As long as they have all of the dlls that they need, you should just be able to run the exe provided you compiled it for their platform (so if you're on Windows and they are on Linux you'd need to compile a Linux binary). If you are using Visual Studio your friend will probably need to have the Visual C++ redistributable installed (http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en is the one for VC++ 2008 but there are versions for 2005 and 2010(forthcoming) as well).

If you've written an application that has a lot of dependencies you can package it all up into an msi to have a full-fledged Windows installer. You can use something like Wix for that (it might require the full version of Visual Studio, I have never used it).

Hopefully that covers what you wanted but if you go into more specifics it will help narrow it down.

Wow thanks for the quick response. I didn't even think about the dll files. You were a huge help. The only issue I could run into is that I do my programming on a mac. Thankfully, I have an netbook that I could transfer my code to and make an exe file. Thanks again

This article has been dead for over six months. Start a new discussion instead.