public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Peter A. Friend" <octavian@corp.earthlink.net>
To: "Thomas Singleton [Eidos]" <singleton@skynet.be>
Cc: help-gcc@gnu.org
Subject: Re: error message : linker input file unused since linking not done
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.10.9912252340150.10881-100000@ebola.it.earthlink.net> (raw)
Message-ID: <19991231222400.ZjVFpCd8YpMOHYJgoGBepihlZw6YEWwVjuQosyGiKHc@z> (raw)
In-Reply-To: <Pine.GSO.4.10.9912252333560.10881-100000@ebola.it.earthlink.net>

On Sat, 25 Dec 1999, Peter A. Friend wrote:

> 
> On Sun, 26 Dec 1999, Thomas Singleton [Eidos] wrote:
> 
> > hello,
> > in order to follow a book's test procedure to see if the compiling/linking
> > of C programs work, i created a hello.c
> > file with the famous 'printf("Hello World!");' then (always following the
> > instructions) did :
> > $gcc -c -Wall -D_GNU_SOURCE hello.c -o hello.o
> > then
> > $gcc -c hello.o hello.c
> > which reported :
> > gcc: hello.o : linker input file unused since linking not done
> > 
> > i made a search for that message on gcc.gnu.org, and found a few linked
> > messages but they were all about merging two or more source into the same
> > object which is not my case, so i decided to post this
> 
> The message that gcc reported is correct. When you supply a library
> (even a compiled object file like you did) to a command that does no
> linking (gcc -c), gcc simply informs you that the library was not used
> because no linking was done. You didn't ask it to. Since you specified
> -c, "source" files are going to be compiled into .o object files, NOT into
> an executable, nor is anything going to be done with any object files. Gcc
> saw the extraneous object file supplied and simply ignored it.

Sorry, I forgot to mention something actually helpful. ;-) What you
probably want to do as the last step is:

gcc -o hello hello.o

or something similar. If those commands were typed verbatim out of the
book, then the book has an error in it. Note that this is simply a long
winded version of:

gcc -o hello hello.c

Which does the same thing.

Peter

  reply	other threads:[~1999-12-31 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-25 15:19 Thomas Singleton [Eidos]
1999-12-25 23:38 ` Peter A. Friend
1999-12-25 23:43   ` Peter A. Friend [this message]
1999-12-31 22:24     ` Peter A. Friend
1999-12-31 22:24   ` Peter A. Friend
1999-12-26  1:42 ` error message : linker input file unused since linking not done SOLVED Thomas Singleton [Eidos]
1999-12-31 22:24   ` Thomas Singleton [Eidos]
1999-12-31 22:24 ` error message : linker input file unused since linking not done Thomas Singleton [Eidos]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.10.9912252340150.10881-100000@ebola.it.earthlink.net \
    --to=octavian@corp.earthlink.net \
    --cc=help-gcc@gnu.org \
    --cc=singleton@skynet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).