Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    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.
    I just don't know how to do it. Any help would be great!
    Last edited by Rick-O-Shay; 04-08-2010 at 05:57 AM.

  2. #2
    Regular Coder BrickInTheWall's Avatar
    Join Date
    Mar 2009
    Munich, Germany
    Thanked 13 Times in 13 Posts
    Once you've written a .c file you have to compile it.
    $ gcc -Wall hello.c -o hello
    -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.
    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!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts