This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: What to do with a.out
- From: "Rupert Wood" <me at rupey dot net>
- To: "'DSC Siltec'" <dscpubl at siltec dot lt>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 8 Apr 2002 18:44:09 +0100
- Subject: RE: What to do with a.out
DSC Siltec wrote:
> I wrote one okay; ran gcc hello.c ; and got a.out
>
> Question 1: What do I do with a.out ?
:
> or run it by typing its name.
Execute it: try './a.out'. It's the default name for a linked
executable. If you want to specify another name, use the '-o' switch.
Unlike dos/windows/etc., most unix-alikes won't check the current
directory for an executable unless you explicitly add it to your PATH.
You can use './<name>' to execute a file in the current directory.
You can use 'file <whatever>' to identify file types; it'll say
something along the lines of:
fox:~$ file a.out
a.out: ELF 32-bit MSB executable SPARC Version 1
except probably 'LSB i686' or some veriane
> 2: Where exactly do I find documentation on the library routines,
> both the standard GCC ones, and then also the X11R6 routines?
man <function-name>
The standard library functions, though, *aren't* GCC's. They belong to
the operating system's C library - in the case of GNU/Linux, this would
be glibc. GCC does, however, provide a number of language extensions and
built-ins; for those, see the GCC manual.
> I'd like to be able to write simple programs with graphics, and have
> decided that I'd prefer X to SVGALIB.
If you want to program for X, you may find it easier to use a toolkit
such as gtk (C) or KDE (C++). Try www.gnome.org.
> 3. In order to avoid asking such questions as this in the
> future, is there a newbie GCC FAQ somewhere?
Not that I know of. But other usual questions are:
* Using maths functions cause linker errors - you need to link in
the maths library with '-lm'
* Using 'gcc' to link C++ code causes linker errors for ostream,
etc. - you should link C++ code using the g++ driver
* C++ STL types don't exist in the global namespace; you need to
import them from the std namespace or address them 'std::'.
Good luck,
Rup.