Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 1997 09:07:32 -0700 (PDT)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Lukas Ruf <lukas@reichardt.ch>
Cc:        questions@FreeBSD.ORG
Subject:   Re: a.out <-> GNU CC
Message-ID:  <Pine.BSF.3.96.971017090154.3407B-100000@gdi.uoregon.edu>
In-Reply-To: <34472f6e.11976311@1.1.1.17>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 17 Oct 1997, Lukas Ruf wrote:

> >> Is there a possibility to link OBJs to a.out using ld / gcc ??
> >
> >Do you mean DOS .OBJ's?  No, the object format is completely different.
> 
> I do not mean DOS .OBJs by writing OBJ.  I use these three characaters
> as a short form of Object Format.

I see.  The extension that UNIX c compilers boot out for object files is
.o, and DOS compilers use .OBJ. 

Then the answer is: Well of course!  A c compiler wouldn't be very useful
if you couldn't generate binaries with it.  :-)

> >If you mean, can FreeBSD compile to a.out format from source, yes, we
> >haven't adopted ELF exclusively yet. 
> 
> I thank you a lot for this nice answer -- but how can I create a.out ?

It's generated automatically by default, assuming you don't give the -c
option to gcc. I don't think FreeBSD ships with the capability to generate
ELF, although an elfkit is available to do so.  I'll accept corrections on
this from the -current crew if I'm off here.

> Could you please give me the solution for gcc 2.7.x and ld ??

Say you have the file hello-world.c that you want to make into an
executable.  Simply execute:

$ gcc hello-world.c

This will generate an executable called ``a.out'' which you can then run
by typing 

$ ./a.out

at the prompt.  If you want to specify the name of the target executable,
you can use the -o option:

$ gcc -o hello-world hello-world.c

Now you get an executable called ``hello-world''.  

Does that help answer your questions?  If you have any more, and you
installed the info distribution, run `info gcc' to get the GCC manual.
Also see `man gcc'.

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971017090154.3407B-100000>