executing c program using Cygwin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvenu1859
    New Member
    • Sep 2007
    • 1

    executing c program using Cygwin

    hi
    can any one please let me know how to execute a c program using cygwin
  • mattmao
    New Member
    • Aug 2007
    • 121

    #2
    Hello.

    I am a user of cygwin.

    First, run the Cygwin, a window would be prompted, inside of which would be a command-line interface:

    Use UNIX commands to move yourself to the right directory where your c codes reside:

    >:pwd
    >:your current location presented to you here
    >: cd somedirectory
    >: ls
    >: . .. test.c

    There you go, you are in the right postion

    Now use the gcc compiler to generate executable file.
    >: gcc test.c

    If your code is fine, you would see nothing from the CLI, but you can check the result

    >: ls
    >: . .. test.c a.exe

    Now the a.exe is the executable file generated by gcc compiler.

    Run it:

    >: ./a.exe






    Note that if you installed Cygwin not properly, you might not have the gcc compiler in your cygwin environment. In this situation I suggest you reinstall cywgin and pay special attention to the time when you are asked to choose the applications. Make sure that the gcc is ticked. I am not quite sure if that is the default option.

    And you can try using the cc compiler to run your code:

    >: cc test.c

    Comment

    Working...