Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help!!!

0 views
Skip to first unread message

Patrice Henry

unread,
Apr 25, 2001, 11:33:25 PM4/25/01
to
This may sound really stupid, but in being a computer technician, I know what it is to be humbled by your work.  If you ever want to feel stupid, fix a computer problem.  I didn't think I could feel much dumber until I tried working on GCC on RH Linux 6.1.  I am trying to learn C, and the book I am reading from to teach myself the process said I needed a compiler.  I found one in Linux, so I thought, great!
 
Well, in trying to actually run the compiler to get through my first lesson (hello, world), I can't figure out how to run GCC.  I have looked at the howto and the man pages, and your home page, but can't figure out just how to do anything more complex than getting the version of GCC that is on my Linux box.  I find the information confusing, with nothing simple that actually tells me how to use the application.  I am new to Linux, so this doesn't help.  I have all but given up hope on how to figure out just how to get it going.  I run the gcc command with <filename>.c and that is about as far as it goes. 
 
I am DOS and Windows trained, and am trying to expand my horizons, so I installed Linux and figured that learning the coding in Linux instead of Windows might help me get more adept at Linux.  I am one of those morons who is used to the GUI and I probably deserve the RTFM response, but everything I have read on this is written for someone that knows how to code in the first place.  There is no step 1, this is how you start the compiler or anything dumbed down that far.  Your web site is pretty much the same way.  There are a bunch of commands, but not the ones I need just to get started.  Any help you could provide would be helpful.  Thanks.

Robert Bernecky

unread,
Apr 25, 2001, 11:43:01 PM4/25/01
to
On Wed, 25 Apr 2001, Patrice Henry wrote:

> This may sound really stupid, but in being a computer
technician, I know what it is to be humbled by your work.

...

Fear not. I've been working with these stupid machines since
1962, and have spent the last month being Very Humbled by
gcc and its friends. Today, I finally ran into one of their
problems instead of one mine.
You are in good company.

More traffic follows, not cc'ing gcc.

Bob

Robert Bernecky Snake Island Research Inc.
bern...@acm.org 18 Fifth Street, Ward's Island
+1 416 203 0854 Toronto, Ontario M5J 2B9 Canada
http://www.snakeisland.com


Zack Weinberg

unread,
Apr 26, 2001, 1:50:33 AM4/26/01
to
On Wed, Apr 25, 2001 at 09:02:29PM -0400, Robert Bernecky wrote:
> If you stuff the above text into a file called "simple.c"
> and then do:
>
> gcc simple.c
>
> you should get a file apeparing called (Don't ask me why -- it's
> stupid, but that's what it does...) a.out.

In the interest of expanding everyone's pile of useless trivia: a.out
stands for "assembler output". If you write a trivial program in
assembly, e.g (i386 and Linux specific)

; iefbr14
.text
.globl _start
_start:
movl $0x0, %ebx
movl $0x1, %eax
int $0x80

and do "as test.s", you'll get a file named a.out. On an ELF-based
system that file is not executable, but with older Unixes it would
have been (maybe needing a chmod +x first). You can make it
executable by running ld on it with no further arguments, except that
ld doesn't like having its input and output have the same name, so you
have to do

$ as test.s -o test.o
$ ld test.o

to get an actual executable a.out on an ELF system.

I've heard a legend that on really old Unixes (pre-V7) a trivial C
program could be compiled and assembled into a complete, executable
a.out without any link phase. Hence, the default executable name is
"a.out" because, way back in the mists of 1970, it really was the
output of the assembler. I'm not sure if I believe this - it seems to
me that libc.a and maybe crt0.o would have been needed from the
beginning.

These days, a.out is still the default output name out of historical
inertia. It's also known not to be the name of any system utility or
application, so convenient for trivial programs. ("test" isn't
suitable, that's a shell builtin, more commonly known as "[".)

Mr. Henry may be interested to know that the name can be changed with
the -o option to the compiler, so:

$ cc simple.c -o simple

will create "simple", not "a.out".

zw

0 new messages