I have built a program on calculating the area of a rectangle as the user inputs the length and width.
It works fine, however, my question is. If I want to send it to someone, what files from the whole folder do I need to send (.zip ). Also, how will they be able to run it, without a compiler.
I can easily run it from:
C:\Documents and Settings\Peter\My Documents\Visual Studio 2005\Projects\optut\debug however, as I've seen other programs, they usually have just a simple .exe file.
If it helps, here is the code:
using
namespace std;int
main(){
int length; // this declares a variable int width; //this declares another variablecout <<
"Enter the length: ";cin >> length;
// input the length (this inputs the value of length from the keyboard)cout <<
"Enter the width: ";cin >> width;
// input the widthcout <<
"The area is " << length * width;getch();
return 0;}
Basically, it's a CLR application and only have one source file.

Running a program?
Yovav
Search for the file on your machine. Then try running it.
I can't help you without you providing more details.
Note: The option is /MT and not /TM
Thanks, Ayman Shoukry VC++ TeamRyanRos
it is .exe file.
Thanks, Ayman Shoukry VC++ Teamlanfong
Ok, well, I created another project as a win32 application. I am a beginner working with C++ so I wasn't sure.
Along with the new project, came another stdafx.cpp file but I suppose I'll just ignore that for now.
Would I still need to use the instructions from your blog regarding the DLL libraries deployment, or is there another more straightforward method
Martin Woodward
Right, I specified /MT in the properties but now it the project won't sucessfully build. However, if I change it back to MDd, it works.
I'm confused :(.
adidion
When I "Build" > "Compile", it says it's succeded. Where would I be able to find this program though as it's not where it was before
Also, when I "Debug" > "Start without debugging", I get over 30 errors and it fails if it's in this /TM mode. It works otherwise.
Osama Alborbar
I am not sure why you are choosing a CLR application since your sample doesn't need to depend on the .Net Framework. You can just pick a win32 console application which removes dependency on the .Net Framework.
Of course if you still need to use CLR applications then the person running it should have the .Net Framework installed on his/her machine.
As for the rest of the files you need to distribute, it depends on how you are linking to the CRT. If you are linking dynamically (using the /MD compiler switch...you can see that from the build log) then you need the SxS binaries. In this case see http://blogs.msdn.com/aymans/archive/2006/04/04/568466.aspx that decribes the possbile options for deploying your application.
If that is still not something necessary for such simple application, you can just link statically to the CRT using the /MT compiler option, in this case you don't need the SxS binaries.
Hope this helps!
Thanks, Ayman Shoukry VC++ TeamJoachim Meyer
I only find the .cpp and object file with the according name on my machine. What extension should this file that I'm looking for have
Yes, sorry, it is /MT, my mistake.
Prunier
I deleted the stdafx.cpp file that came default with the new win32 application and thus I get this error:
Icanreadabook
RMS rookie
If you build with /MT then you don't need the info from my blog. Take a look at http://msdn2.microsoft.com/en-US/library/2kzt1wy3.aspx on how to specify /MT
Thanks, Ayman Shoukry VC++ Teamrichwu
Could you try by creating an "Empty" win32 application and then add a .cpp file to it.
The copy the below file into the new cpp file you added:
#include <iostream>
using namespace std;
int main()
{
int length; // this declares a variable
int width; //this declares another variable
cout << "Enter the length: ";
cin >> length; // input the length (this inputs the value of length from the keyboard)
cout << "Enter the width: ";
cin >> width; // input the width
cout << "The area is " << length * width;
//getch();
return 0;
}
Then try compiling!
Thanks, Ayman Shoukry VC++ TeamEric Frick
What is the error you are getting
Thanks, Ayman Shoukry VC++ Team