[.net] Creating a .exe in visual C++ express

Started by
4 comments, last by Xadrieth 16 years ago
I was wondering how you can save a solution/project as a .exe or installer file to run on other computers. I use Microsoft's "Visual C++ Express Edition" for my programming. I have already tried using the MSDN site for help, but it does not give me anything. Also, does anyone know a good book for Developing games in C++, im currently using the "C++ for Dummies" book, and all it's doing it teaching me how to make console apps(DOS things).
Advertisement
When you compile it, it creates an EXE. That's what gets run when you debug it (F5). It's saved under <yoursolutionFile>\Debug\ or, more generically stated: <yoursolutionFile>\<configuration>
You can just zip that up (make sure you have the correct relative pathing used in your code).

Alternatively you can create an installer, but that's a separate thing, google around for that.

-me
Thanks but I'm still a little confused. what files do i need to include with the .exe . All the kind of programming that i have done is just source code, no header files, no resorce files, just source code. So do i just need to inlclude the .exe and .cpp file, or some other things?
Your .cpp file is compiled into an .exe file. After this, you no longer need the .cpp file to run your program (but don't delete it, you can't turn the .exe back into a source code, so you'll still need them if you want to edit your program!).

To distribute the .exe to your friends, you have to do a release build (By default, VC++ Express does this when you press Ctrl+F5 or "Build Solution" from the "Build" menu. You can then find the .exe in the "Release" folder of your project.

Your friends will also have to install the Visual C++ runtime. If you are using Visual C++ Express 2008, have them install this file if they're running a 32 bits windows system:
http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Quote:Original post by Cygon
Your .cpp file is compiled into an .exe file. After this, you no longer need the .cpp file to run your program (but don't delete it, you can't turn the .exe back into a source code, so you'll still need them if you want to edit your program!).

To distribute the .exe to your friends, you have to do a release build (By default, VC++ Express does this when you press Ctrl+F5 or "Build Solution" from the "Build" menu. You can then find the .exe in the "Release" folder of your project.

Your friends will also have to install the Visual C++ runtime. If you are using Visual C++ Express 2008, have them install this file if they're running a 32 bits windows system:
http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

-Markus-

For a beginner using a Visual Studio Setup project would be the easiest way to redistribute your C++ app to others but you need the full version of Visual Studio for that.
So you are stuck with option #2 here:
Action
Upgrading a Visual C++ application that dynamically links to the MSVC Runtime, MFC, and/or ATL DLLs to a version of Visual Studio 2005 or greater.

Back to the top
Result
Your VC++ application may not launch on target machines due to a missing Microsoft DLL dependency.

When attempting to launch the upgraded application on a target (non-development) machine, you receive the error "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem."

The event viewer will contain error messages in the System log with the Source "SideBySide". Messages will reference the application you attempted to launch as well as information such as "The referenced assembly is not installed on your system..." and "Dependent Assembly Microsoft.VC80.CRT could not be found..." or "Dependent Assembly Microsoft.VC90.CRT could not be found..." depending on the version of Visual Studio you upgraded to.

Back to the top
Cause
The MSVC DLLs (MSVCRx0, MFCx0, ATLx0, etc.) now need to be installed in the Windows Side-by-Side folder, WinSxS.

Back to the top
Resolution
There are two solutions:
1. Use a Visual Studio Setup project (in your C++ solution) to install via the vcredist merge module.
2. Run the appropriate redistribution installer (such as vcredist_x86.exe) on the target machine.
a. On your development obtain the vcedist executable at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86. (If you are running a 64 bit version of windows this will be in the x86 Program files folder).
b. Copy this to the target computer and execute it.

Here is a more in-depth article on it here:
Redistributing Visual C++ Files
And AFAIK starting out learning C++ using console apps is the best way to start since you are not overloaded with all the non C++ standard graphics api stuff not to mention the extra complexities.
I recommend the mike dawson C++ book if you are just starting out. And it shows you how to make the basic games in C++ like hangman,tic-tac-toe,blackjack,etc.



[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Quote:Original post by daviangel
Quote:Original post by Cygon
Your .cpp file is compiled into an .exe file. After this, you no longer need the .cpp file to run your program (but don't delete it, you can't turn the .exe back into a source code, so you'll still need them if you want to edit your program!).

To distribute the .exe to your friends, you have to do a release build (By default, VC++ Express does this when you press Ctrl+F5 or "Build Solution" from the "Build" menu. You can then find the .exe in the "Release" folder of your project.

Your friends will also have to install the Visual C++ runtime. If you are using Visual C++ Express 2008, have them install this file if they're running a 32 bits windows system:
http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF

-Markus-

For a beginner using a Visual Studio Setup project would be the easiest way to redistribute your C++ app to others but you need the full version of Visual Studio for that.
So you are stuck with option #2 here:
Action
Upgrading a Visual C++ application that dynamically links to the MSVC Runtime, MFC, and/or ATL DLLs to a version of Visual Studio 2005 or greater.

Back to the top
Result
Your VC++ application may not launch on target machines due to a missing Microsoft DLL dependency.

When attempting to launch the upgraded application on a target (non-development) machine, you receive the error "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem."

The event viewer will contain error messages in the System log with the Source "SideBySide". Messages will reference the application you attempted to launch as well as information such as "The referenced assembly is not installed on your system..." and "Dependent Assembly Microsoft.VC80.CRT could not be found..." or "Dependent Assembly Microsoft.VC90.CRT could not be found..." depending on the version of Visual Studio you upgraded to.

Back to the top
Cause
The MSVC DLLs (MSVCRx0, MFCx0, ATLx0, etc.) now need to be installed in the Windows Side-by-Side folder, WinSxS.

Back to the top
Resolution
There are two solutions:
1. Use a Visual Studio Setup project (in your C++ solution) to install via the vcredist merge module.
2. Run the appropriate redistribution installer (such as vcredist_x86.exe) on the target machine.
a. On your development obtain the vcedist executable at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86. (If you are running a 64 bit version of windows this will be in the x86 Program files folder).
b. Copy this to the target computer and execute it.

Here is a more in-depth article on it here:
Redistributing Visual C++ Files
And AFAIK starting out learning C++ using console apps is the best way to start since you are not overloaded with all the non C++ standard graphics api stuff not to mention the extra complexities.
I recommend the mike dawson C++ book if you are just starting out. And it shows you how to make the basic games in C++ like hangman,tic-tac-toe,blackjack,etc.


Thanks, also that book you recmended, i wanted to get that one from borders, but all the book stores i went to did not have it. I have tried the other "Thomson Course Tech." books and their all great.

This topic is closed to new replies.

Advertisement