954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

create a program exe file in C.

hello, can any 1 please help/guide me for creating an program .exe file in C. as i am using Dev c++ compiler.say for E.g( program of addition in this by compiling & running it i get the required output. but if i dont want to run the program again n again in c code.instead of it i just create 1 exe file so that when i double click it. it automatically runs & produces the required output.although the s/w itself produces the exe file. but it opens along with all the supported/assosciated files with it. i just require only 1 exe file.

kapilsolanki84
Newbie Poster
13 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

The exe file is created automatically when you run your program. It is located in the same directory where your source file resides.

saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 

Isn't it created when you compile, your program, saad749?

I don't use that compiler but there should be a specific directory (maybe debug or release) where your .exe is being produced on compilation.

You can execute that file just like any other executable.

Isaac Remuant
Newbie Poster
24 posts since Apr 2010
Reputation Points: 50
Solved Threads: 4
 

Yes, the exe file is created the moment program is compiled. It is created in the same directory as the source file.

saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 

yes it is been created in the same project directory.bt i want the exe file to be seperated from others its associated file. means all the assosciated file should reside inside it & not outside of it.it cant be open without that assosciated file.

kapilsolanki84
Newbie Poster
13 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

When you compile a program the compiler generates the executable program that is usually self-contained except maybe for a few operating system shared libraries and DLLs. You can move the executable program any where you wish on your computer and it will normally run without problems. The source files (*.cpp and *.h) are not needed after they have been compiled. The compiler puts the exe file in the same folder as the source files only for your convenience.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

BTW if u r using image file or other external files you will need to move the respected files along with the exe file. The Source and header files as MENTIONED ABOVE are NOT NEEDED.

saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 

now i wan the exe to be secured that is no body can cm to know that it is a c compiler file. only the source can cm to know that it is file assosciated with itself.rt nw it is creating a exe file on which double click produces the required output. i wan only the producer of that exe file can run it. else nobody can cm to about it.

kapilsolanki84
Newbie Poster
13 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Just don't give the exe file to anybody then :-/. Just give away the .c file to someone.

saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 
now i wan the exe to be secured that is no body can cm to know that it is a c compiler file. only the source can cm to know that it is file assosciated with itself.rt nw it is creating a exe file on which double click produces the required output. i wan only the producer of that exe file can run it. else nobody can cm to about it.

Can you retype that? I'm really not understanding this :s
Are you saying you want to hide the .exe separate from the source file?

Kamatari
Light Poster
37 posts since Nov 2010
Reputation Points: 11
Solved Threads: 6
 

No -- he is saying he wants to hide the program from everyone except himself -- sounds pretty malicious to me. It's not even possible on MS-Windows because anyone with Admin privaledges can view every program in the system. Programs can not be hidden from Admins or antivirus programs, and for good reason.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Then Use a file locker program for that, :P

saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 

Sadly, FolderSafe is not compatible with 64-bit Windows 7. I was going to install it on my computer to see how good or bad it is but it doesn't work.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
saad749
Light Poster
45 posts since Sep 2010
Reputation Points: 10
Solved Threads: 5
 

The best and simplest way to keep data private is to put the data on a flash drive (or usb drive) so that you can remove it from the computer when you are not working with it.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

" i just create 1 exe file so that when i double click it. it automatically runs & produces the required output.although the s/w itself produces the exe file. but it opens along with all the supported/assosciated files with it. i just require only 1 exe file. "

i think kapil wanted to say when he is running that created exe file thats running well but its also opening the source code of that exe file.
he just want to keep that exe file in seprate folder and when he or someone else click on that exe file only that exe file get executed.

vinitmittal2008
Junior Poster
135 posts since Oct 2010
Reputation Points: 50
Solved Threads: 20
 

>>but its also opening the source code of that exe file
The OP is most likely wrong about that. *.exe programs don't need the source code for its own program. When I compile Hello.cpp to create Hello.exe the *.exe file doesn't need Hello.cpp. It might need some other shared libraries or DLLs, but that's a different problem.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

ohh, i catch it wrong..

vinitmittal2008
Junior Poster
135 posts since Oct 2010
Reputation Points: 50
Solved Threads: 20
 
now i wan the exe to be secured that is no body can cm to know that it is a c compiler file. only the source can cm to know that it is file assosciated with itself.rt nw it is creating a exe file on which double click produces the required output. i wan only the producer of that exe file can run it. else nobody can cm to about it.

I think the best way from preventing someone from using your .exe file without actually hiding the file is by compressing into a zipt file and locking (encrypting) it with a password.

next time you can extract your .exe file using this password......

sharunks007
Newbie Poster
7 posts since Dec 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: