Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: GCC commands to execute C file?
04-08-2010, 05:52 AM #1
- Join Date
- Jan 2010
- Thanked 0 Times in 0 Posts
GCC commands to execute C file?
I have a program written in C that I want to run. I have installed Cygwin and GCC. I want to run the program but I know nothing about GCC commands. How do I use GCC to execute my C file?
The person who gave me the code told me this
My suggestion is you download and install cygwin ( http://www.cygwin.com/ ) which is a Linux environment which runs on top of Windows. It has many pieces, but I suspect you will need gcc (A C compilier) and make (a batch processing tool) to build the program, then you will need apache (a web page server) to access the game's web pages and download the client.
Last edited by Rick-O-Shay; 04-08-2010 at 05:57 AM.
04-08-2010, 09:59 AM #2
- Join Date
- Mar 2009
- Munich, Germany
- Thanked 13 Times in 13 Posts
Once you've written a .c file you have to compile it.
-Wall will show you errors if there are any, -o means to compile the .c file to an executable, and "hello" is the program name.Code:$ gcc -Wall hello.c -o hello
You can also compile everything to object files first with -c instead of -o. and then compile those .o files to machine code using -c.
It's all in here: http://www.network-theory.co.uk/docs/gccintro/
If you're on linux you can use $ ./hello to run this program.
Call me Brick, if you like!