Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Fist steps in compiling, gcc commands confusion |
| Date | 2015-04-21 12:11 -0700 |
| Organization | None to speak of |
| Message-ID | <87383tmh4i.fsf@kst-u.example.com> (permalink) |
| References | <9f1b89ff-cf47-4e01-b137-ba263e9e75f1@googlegroups.com> <mh615a$db6$1@dont-email.me> |
Bartc <bc@freeuk.com> writes:
[...]
> gcc sample.c
>
> compiles "sample.c" into an object file "sample.c", and then links
> that into the executable file "a.out" (don't ask why), which you have
> to run using:
>
> ./a.out
I presume that was a typo; the object file is named "sample.o".
> gcc -c sample.c
>
> compiles "sample.c" into an object file "sample.c" only; it doesn't
> create an executable.
>
> Summary:
>
> * Every .c input file is compiled into a corresponding .o file.
>
> * gcc will always link all input files (.c or already-compiled .o)
> into an executable unless -c is used.
>
> * gcc will always name the executable "a.out" unless -o is used.
If you tell it to produce an executable (by not specifying "-c"), any
generated .o files are automatically deleted.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Fist steps in compiling, gcc commands confusion Alla _ <modelling.data@gmail.com> - 2015-04-21 08:18 -0700
Re: Fist steps in compiling, gcc commands confusion Alla _ <modelling.data@gmail.com> - 2015-04-21 08:25 -0700
Re: Fist steps in compiling, gcc commands confusion Morris Dovey <mrdovey@iedu.com> - 2015-04-21 10:56 -0500
Re: Fist steps in compiling, gcc commands confusion David Brown <david.brown@hesbynett.no> - 2015-04-22 09:35 +0200
Re: Fist steps in compiling, gcc commands confusion James Kuyper <jameskuyper@verizon.net> - 2015-04-22 11:15 -0400
Re: Fist steps in compiling, gcc commands confusion David Brown <david.brown@hesbynett.no> - 2015-04-23 01:31 +0200
Re: Fist steps in compiling, gcc commands confusion Keith Thompson <kst-u@mib.org> - 2015-04-22 08:43 -0700
Re: Fist steps in compiling, gcc commands confusion Bartc <bc@freeuk.com> - 2015-04-22 18:57 +0100
Re: Fist steps in compiling, gcc commands confusion Keith Thompson <kst-u@mib.org> - 2015-04-22 11:35 -0700
Re: Fist steps in compiling, gcc commands confusion James Kuyper <jameskuyper@verizon.net> - 2015-04-21 12:01 -0400
Re: Fist steps in compiling, gcc commands confusion John Gordon <gordon@panix.com> - 2015-04-21 16:01 +0000
Re: Fist steps in compiling, gcc commands confusion Tim Prince <tprince@computer.org> - 2015-04-21 13:11 -0400
Re: Fist steps in compiling, gcc commands confusion Keith Thompson <kst-u@mib.org> - 2015-04-21 12:09 -0700
Re: Fist steps in compiling, gcc commands confusion Bartc <bc@freeuk.com> - 2015-04-21 18:25 +0100
Re: Fist steps in compiling, gcc commands confusion Keith Thompson <kst-u@mib.org> - 2015-04-21 12:11 -0700
Re: Fist steps in compiling, gcc commands confusion Keith Thompson <kst-u@mib.org> - 2015-04-21 11:16 -0700
csiph-web