How to Allow People to Use Your C Program

+2 Ahmed Raza · August 4, 2015
So, I have a question which might come across as kind of noobish but I had a really hard time finding anything online. I would really appreciate any [straightforward] answers. :)

My question is: Let's say I write a C program that calculates your age. I want my friend, a non-programmer, to test it out. He doesn't have a compiler and wouldn't know how to compile. He simply wants to be able to use the program by clicking on it and putting in the information it asks. How would I go about doing that? Would I have to build a GUI or is there some other way?

Thank you in advance!

Post a Reply

Replies

Oldest  Newest  Rating
+1 Jon Z. · August 9, 2015
In windows after you compile your program you should end up with a .exe file. The .exe file you should be able to run in any other computer running windows.
If you want to run your program in a computer running a different OS, then you need to compile it for that specific OS.
+1 Jon Z. · August 4, 2015
You can compile it and give your friend the executable file to run your program.
No GUI should be required.
+1 Ahmed Raza · August 4, 2015
I see, thank you so much. However, when I try to send an executable file (you do mean the .out file, correct?) to a WIndows computer, I can't use it. How would I change that?
+1 David Green · August 5, 2015
You'd have to figure out how to compile it into an PE file format and put the extention to .exe, you couldn't run it but he could
+1 c student · August 5, 2015
c programs are not cross platform.  if you compile on a linux machine, it can only be executed by a linux machine (or some interpreter).  this applies to all platforms including windows and osx.
+1 David Green · August 5, 2015
c student, not necessarily, if you can force your compiler to output for a certain platform, it will work. Windows platform is the PE executable file format, however working with WinAPI is probably a different story.
+1 Ahmed Raza · August 6, 2015
I see. How would I save my C program in terminal to a PE file?
Lastly, how would this apply to Java programs?
+1 c student · August 6, 2015
"For a piece of software to be considered cross-platform, it must be able to function on more than one computer architecture or operating system."*

c programs are not platform independent because they cannot be run on different architectures/operating systems.  the compiler builds the program specifically so that the system can load it properly.  yes, you can specify which system to build for, however the resulting program will not be platform independent.  if you want platform independence, java is a good example.

*Wikipedia, <https://en.wikipedia.org/wiki/Cross-platform#Cross-platform_software>
  • 1

C

107,288 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator