Jump to content
  • Advertisement
Sign in to follow this  
Xadrieth

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

This topic is 3786 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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-

Share this post


Link to post
Share on other sites
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.



Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!