Change the assembly of the output directory when creating through the terminal

I recently found a program that is a mixture between an IDE and a text editor. It supports the syntax of the language and formats it, but it does not create or run a program for you. I am running Mac OS X 10.6.8. I looked at how to create C code using the Terminal application. Format:

gcc [file]

Pretty simple. The problem is that I cannot change the directory in which the embedded file is displayed, and I cannot change the name. By default, each compiled file is displayed in the home directory by the name 'a.out.' How can I specify the output directory and name?

Thank!

+3
source share
1 answer

gcc -o . . :.

$ ls
program.c
$ gcc program.c -o program
$ ls
program   program.c
$ mkdir bin
$ gcc program.c -o bin/program
$ ls bin
program
$ 

, :

  • -std=c99, -std=gnu99: c99/ gnu.
  • -Wall, -Wextra, -pedantic: .
  • -O0 -ggdb: . , gdb.
  • -O2: . -O0.
+7

All Articles