1

I want to compile a C source code which I wrote in one directory in another directory. Is it possible like this? If it is possible how do I achieve that?

Kulfy
  • 17,696

1 Answers1

2

Try this for compiling.

gcc file.c -o directory/myOutput

and run it.

./directory/myOutput 

if this doesn't work try this for compile and move the output file to a directory.

gcc file.c -o [compiled ouput file] & mv [compiled ouput file] [your directory]