Pages

Wednesday, August 14, 2013

Compile C programs with gcc/cygwin


Compile C programs with gcc/cygwin

Open Cygwin terminal and type $ 'cd /cygdrive; ls'. Go to particular directory of any of the shown drives.

$ cd /cygdrive; ls

$ gcc -o o.exe file1.c

If a program consists of more than one file;

$ gcc -o o.exe file1.c file2.c file3.c

If you want to take inputs from a file, instead of entering one by one from the keyboard for scanf() inputs;

$  ./o.exe < ../sum1.dat

sum1.dat is in one directory up to the current directory.















No comments:

Post a Comment