Creating .exe file from source code

Pages: 12
I want to create a .exe file from the source code of the program. How can I do that? The compiler I am using is Turbo C++ 3.0. Can I also have some help on the working of exe files?
My OS is Windows XP, then how can I get the program to run outside the ide? Can I run it even in systems that do not have a C++ compiler, or another compiler other than turbo C++?
I tried googling the solution, but got only instructions related to Dev C++. So I understood pretty much nothing. Also because I'm not so familiar with the compiler, I didn't understand what to do. I usually run the programs by choosing the run option after compiling. But the source code is always open. What should I do to get it to run without showing the source code?


Thanks in advance
The compiler takes as input the source code and generates as output an executable (exe) file.

Your IDE should have an option to compile the project. That will generate an EXE somewhere on your disk.
Run the EXE as you would any other EXE.
you gotta change it from debug mode to release mode
should be in the top it'll say debug/release/configuration manager
when you do it in Release mode it will create the .exe
Look where you save your source file, alway C++ Compilers generate two files, let say your source named "hello.cpp"
These files should be in your source path:
hello.obj
hello.exe <--your prgram to distribut

ALSO

I think you should use new free IDE/Compiler for better result such as:CodeBlocks at http://www.codeblocks.org

Of course, it has an option to compile, but I can only compile and run it inside the ide. Once I close it, i can't run the program. And even if I can run the program,I can still see the source code after executing it each time. That is the actual problem. Please help me solve it?
The source code is stored in a text file and you can "see" it as long as the file is in your computer. The .exe file is completely independent, in the way a blueprint is independent from the building it describes.

When your IDE compiles the source files, it probably generates a .exe file somewhere. Look for it and try to run it by itself.
When your IDE compile source file, it actual generate .exe file not converting source to .exe !!--so as filepe said
The source code is stored in a text file and you can "see" it as long as the file is in your computer
Hey guys, I tweaked around the ide and found out how to make the program to run outside the compiler. Thanks to all of u guys for your help.
And mazd, I did download codeblocks. But I couldn't even run a program to add 2 numbers. It showed some kind of an error with the <iostream.h> header file. So I couldn't use it, and I had to delete it and am still running with turbo.Any help?
Thaks to all of you guys. What I did was to go to the compile option on the toolbar and clicked on link. Problem solved. Thanks...
My old topic is solved, but since I have a new one,(about the compiler) should I mark it as solved?
Am not familiar with codeblocks but this one work in wxDev C++ which use same compiler as CodeBlocks (MingWC)
1
2
3
4
5
6
7
8
9
10
11
#include<iostream.h>//<-----<iostream> also work
using namespace std;

int main(){
int y=2;
int z=3;
int x =y + z;
cout<<x;
cin.ignore();
return 0;
}
#include<iostream.h>//<-----<iostream> also work

<iostream.h> is deprecated. Don't use it. Use <iostream>.
Last edited on
Yes, I tried both <iostream.h> and <iostream>. Still no use. And my compiler is turbo C++ 3.0, so can't use <iostream>.
Last edited on
Anyway guys, thanks a lot for your help... Specially you, mazd, for the codeblocks. Well, I haven't been able to run it, but it's alright coz I've got ny good old turbo. Thanks again
May be you have download COdeBlocks without Compiler---make your setup file is something like"codeblocks-8.02mingw-setup"(version number may vary)...I mean you have download IDE without compiler.
Last edited on
im not sure about other compilers because i stick with Visual Studio (its also free) lol

anyways on VS it gives you an option to compile in Debug mode/Release mode <-- if you run in Release it creates a .exe for you
In turbo, we compile it, and then select 'link' from the compile option.
Anyway, Legion, can you help me a bit more about the VS? It sounds good.
Mazd, I will try it the way you said, and I'll tell you what happens. Thanks a lot guys...
And do you guys know anything about C# ? Any good sites where we can learn it? Thanks
Am not familiar with C# George M but i have heard that, it is used for coding web and windows applications, so it better to specify your need for expert to help you.
Legion, can you help me a bit more about the VS? It sounds good.

What is the problem with you in VISUAL STUDIO? and What language you use in VS(J#,C#,VC++ OR Visual Basic.)?
I'm using it for all my programming stuffs--you may email me at hermitscorp@gmail.com or ask me here, or visit http://www.hermitscorp.350.com to see what we can do with it.(some of my stuff there i did with it).
...Happy coding
__Al-mazeedy(More)!
Actually Said, there is no problem for me with visual studio. I was just asking for more information about VS, so that I can start using it too. Can you help me? Thanks...
And you gave me a piece of code, right, for adding two numbers? Can you tell me the use of cin.ignore? I write the programs with <conio.h> andgetch();. So, I dont know what it is used for. Please help. Thanks...
Pages: 12