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

Renaming a.out to .EXE???

1,653 views
Skip to first unread message

ahyeop

unread,
Mar 2, 1998, 3:00:00 AM3/2/98
to
Two questions :
1. Can I rename unixes 'a.out' into .EXE ?
2. Can I change 'a.out' to my own prefered names and will it works
w/out any hitch ?

Thanks for the help :-)
Ahyeop, Malaysia
ahy...@tm.net.my

vcard.vcf
vcard.vcf

Grump

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

(G)CC names its output "a.out" by default. You can remame it to anything
you want, in fact you should. Better yet, you can specify the name on the
command line, or in a script or makefile with the "-o" option, like this

GCC myfile.c -o progname <etc...>

Good luck.

On Mon, 02 Mar 1998 22:59:58 +0800, ahyeop <ahy...@tm.net.my> wrote:
>This is a multi-part message in MIME format.
>--------------2A8DF3878E367350B85E9EFE
>Content-Type: text/plain; charset=x-UNICODE-2-0-UTF-7
>Content-Transfer-Encoding: 7bit

>--------------2A8DF3878E367350B85E9EFE
>Content-Type: text/x-vcard; charset=x-UNICODE-2-0-UTF-7; name="vcard.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Mohd Mokhtar Ahmad Dziauddin
>Content-Disposition: attachment; filename="vcard.vcf"
>
>begin: vcard
>fn: Mohd Mokhtar Ahmad Dziauddin
>n: Ahmad Dziauddin;Mohd Mokhtar
>org: Ahyeop Secret Lab
>adr: ;;;Ipoh Darul Ridzuan;Perak;;Malaysia
>email;internet: ahy...@tm.net.my
>x-mozilla-cpt: ;0
>x-mozilla-html: FALSE
>version: 2.1
>end: vcard
>
>
>
>--------------2A8DF3878E367350B85E9EFE
>Content-Type: text/x-vcard; charset=x-UNICODE-2-0-UTF-7; name="vcard.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Mohd Mokhtar Ahmad Dziauddin
>Content-Disposition: attachment; filename="vcard.vcf"
>
>begin: vcard
>fn: Mohd Mokhtar Ahmad Dziauddin
>n: Ahmad Dziauddin;Mohd Mokhtar
>org: Ahyeop Secret Lab
>adr: ;;;Ipoh Darul Ridzuan;Perak;;Malaysia
>email;internet: ahy...@tm.net.my
>x-mozilla-cpt: ;0
>x-mozilla-html: FALSE
>version: 2.1
>end: vcard
>
>
>--------------2A8DF3878E367350B85E9EFE--
>
>
>

Frank Sweetser

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

ahyeop <ahy...@tm.net.my> writes:


> Two questions :
> 1. Can I rename unixes 'a.out' into .EXE ?
> 2. Can I change 'a.out' to my own prefered names and will it works
> w/out any hitch ?

you can name the binary any damn name you can type! :) linux, unlike some
other OS's (windows) doesn't rely on the filename to determine the file
type. instead, when trying to run a file, the kernel looks at some magic
numbers stored in the beginning of the file and runs the appropriate
interpreter (ELF, a.out, script, etc). so, IOW, yes. 8)

--
Frank Sweetser rasmusin at wpi.edu fsweetser at blee.net | PGP key available
paramount.res.wpi.net RH 5.0 kernel 2.0.33/2.1.89p5 i586 | at public servers
Not me, guy. I read the Bash man page each day like a Jehovah's Witness reads
the Bible. No wait, the Bash man page IS the bible. Excuse me...
(More on confusing aliases, taken from comp.os.linux.misc)

Paul Hughett

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

ahyeop (ahy...@tm.net.my) wrote:

: Two questions :


: 1. Can I rename unixes 'a.out' into .EXE ?
: 2. Can I change 'a.out' to my own prefered names and will it works
: w/out any hitch ?

If you compile with something like

gcc -o foo.exe foo.c

the compiler will produce an executable file named foo.exe which you
can execute by typing

foo.exe

But it is more common under Unix to compile with

gcc -o foo foo.c

and execute with just

foo

Unix was developed on 10 character-per-second teletypes, and some of the
habits formed then are still with us.

Paul Hughett

firewind

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

On 3 Mar 1998, Paul Hughett wrote:

> Unix was developed on 10 character-per-second teletypes, and some of the
> habits formed then are still with us.

Explain how Unix's sensible approach to executable files has anything to
do with teletypes.

--
(initiator of the campaign for grumpiness where grumpiness is due in c.l.c)

Attempting to write in a hybrid which can be compiled by either a C compiler
or a C++ compiler produces a compromise language which combines the drawbacks
of both with the advantages of neither.
-- John Winters <jo...@polo.demon.co.uk> in comp.lang.c


Scott Johnson

unread,
Mar 3, 1998, 3:00:00 AM3/3/98
to

Jon Plews wrote:
>
> ahyeop <ahy...@tm.net.my> wrote in article <34FAC96E...@tm.net.my>...

> > Two questions :
> > 1. Can I rename unixes 'a.out' into .EXE ?
> > 2. Can I change 'a.out' to my own prefered names and will it works
> > w/out any hitch ?
> >
>
> a.out is the default linker output.
>
> Rename it to whatever you want. I would suggest, however, that putting
> an .exe extension on it is a little silly ...
>
> Jon.

It probably should be mentioned, however, that calling a Unix binary
*.exe will NOT make it run on Windoze, even if compiled for an Intel
processor. (Nor would renaming the output of a Windoze compiler to
"a.out" make it run on a Unix system...though some Unices available for
PC are known to run DOS/Windoze binaries with add-on packages...)

The binary file formats commonly used by Unices (a.out, ELF, etc.) are
rather different than the binary format used by Windoze. Plus the
libraries are different, etc and so on.


Scott, who is wondering if ld.so would complain if he renamed all his
shared libraries *.dll :)

Christopher Browne

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

On Mon, 02 Mar 1998 22:59:58 +0800, ahyeop <ahy...@tm.net.my> wrote:
>Two questions :
>1. Can I rename unixes 'a.out' into .EXE ?

Yes. On UNIX systems, people normally do not use file "extenders" in
this fashion; extenders are usually used to indicate what kind of
"source code" file one is working with.

If the resulting program is an X-based animation program, one would
typically call it something like "xanim" or "Xanim" rather than the CP/M
approach of calling it "xanim.exe." (No doubt there was some system that
CP/M was copying from when it used this sort of naming approach; I was
too young to encounter such systems...)

>2. Can I change 'a.out' to my own prefered names and will it works
>w/out any hitch ?

If the program explicitly looks for its name, and behaves in different
ways based on that name, then the answer is "no." You see this sort of
behaviour with such programs as "vi" (which often behaves differently
depending on whether it's named "vi," "view," or "ex") or the NetPBM
utilities.

More typically, you can use whatever name you prefer without any major
hitches.
--
"...[Linux's] capacity to talk via any medium except smoke signals."
(By Dr. Greg Wettstein, Roger Maris Cancer Center)
cbbr...@hex.net - <http://www.hex.net/~cbbrowne/lsf.html>

Jon Plews

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to


ahyeop <ahy...@tm.net.my> wrote in article <34FAC96E...@tm.net.my>...

> Two questions :
> 1. Can I rename unixes 'a.out' into .EXE ?

> 2. Can I change 'a.out' to my own prefered names and will it works
> w/out any hitch ?
>

a.out is the default linker output.

Kaz Kylheku

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

In article <01bd46e4$4a926d80$0201010a@groover>,

Jon Plews <jonp...@dial.pipex.com> wrote:
>
>
>ahyeop <ahy...@tm.net.my> wrote in article <34FAC96E...@tm.net.my>...
>> Two questions :
>> 1. Can I rename unixes 'a.out' into .EXE ?
>> 2. Can I change 'a.out' to my own prefered names and will it works
>> w/out any hitch ?
>>
>
>a.out is the default linker output.

Under a _real_ operating system anyway. Not these Microslop systems
that ignore the roots of where it all came from.

(Bob Nelson seems to be on vacation; someone's gotta pick up the slack! <g>)

Will Rose

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Christopher Browne (cbbr...@news.hex.net) wrote:
: On Mon, 02 Mar 1998 22:59:58 +0800, ahyeop <ahy...@tm.net.my> wrote:
: >Two questions :

: >1. Can I rename unixes 'a.out' into .EXE ?

: Yes. On UNIX systems, people normally do not use file "extenders" in


: this fashion; extenders are usually used to indicate what kind of
: "source code" file one is working with.

: If the resulting program is an X-based animation program, one would
: typically call it something like "xanim" or "Xanim" rather than the CP/M
: approach of calling it "xanim.exe." (No doubt there was some system that
: CP/M was copying from when it used this sort of naming approach; I was
: too young to encounter such systems...)

Too young to remember, also, that CP/M (of blessed memory) didn't
have .exe files. It had only .COM files, and .SUB scripts. But
I don't know where the naming came from; some of CP/M apparently
came from TOPS, but I'm too young to remember TOPS.


Will
c...@crash.cts.com


John Winters

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

In article <34FAC96E...@tm.net.my>, ahyeop <news.tm.net.my> wrote:
>This is a multi-part message in MIME format.
>--------------2A8DF3878E367350B85E9EFE
>Content-Type: text/plain; charset=x-UNICODE-2-0-UTF-7
>Content-Transfer-Encoding: 7bit

Please turn off this encoding. Usenet is a text medium.

>
>Two questions :
>1. Can I rename unixes 'a.out' into .EXE ?

Under UNIX you can rename them to pretty well anything you like. Bear
in mind though that if you rename "a.out" as ".EXE":

a) It won't show up in directory listings.
b) You'll have to type ./.EXE to run it.

>2. Can I change 'a.out' to my own prefered names and will it works
>w/out any hitch ?

If you specify an output file name to your compiler you can have any
name you like. Potential problems arise when you use a name which
is recognised as a command internally by your shell, in which case
you'll have to use an explicit path, even if it is on your PATH, when
you invoke it.

>
>Thanks for the help :-)
>Ahyeop, Malaysia

Snip waste of bandwidth.

HTH
John

(Copy and follow-ups set.)
--
John Winters. Wallingford, Oxon, England.

The Linux Emporium - a source for Linux CDs in the UK
See <http://www.polo.demon.co.uk/emporium.html>

Juergen Ilse

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Hello,

In alt.os.linux ahyeop <ahy...@tm.net.my> wrote:
: This is a multi-part message in MIME format.

: Two questions :


: 1. Can I rename unixes 'a.out' into .EXE ?

You can, but why do you want to do so??? Within a unix system, executables
are files with execute-right set (the filetype would be recognized depending
on the contents). There is no "all .exe file are executable" like within DOS
or Windows...
If you want to change the name, give it a meaningful name without extension
like ".exe" or ".com". To start the program, you have to type the full name
and do you really want to type "my_prog.exe" instead of "my_prog"?

: 2. Can I change 'a.out' to my own prefered names and will it works
: w/out any hitch ?

No problem, but you should avoid names of standard unix-utilities (like
"test", "ls", "rm",...). Many new unix-users name there own program "test"
and wonder why it is not doing what they expect... Note that in unix a file
is searched in all directories listed in the environment-variable PATH, and
exact in the order listed there. In most unix-environment, "." (the current
directory) is listed at the end of PATH (or in some cases "." is not in the
PATH at all). DOS/Windows searches first in the current directory for the
executable, unix not!!!

: --------------2A8DF3878E367350B85E9EFE


: Content-Type: text/x-vcard; charset=x-UNICODE-2-0-UTF-7; name="vcard.vcf"
: Content-Transfer-Encoding: 7bit
: Content-Description: Card for Mohd Mokhtar Ahmad Dziauddin
: Content-Disposition: attachment; filename="vcard.vcf"

: begin: vcard
: fn: Mohd Mokhtar Ahmad Dziauddin
: n: Ahmad Dziauddin;Mohd Mokhtar
: org: Ahyeop Secret Lab
: adr: ;;;Ipoh Darul Ridzuan;Perak;;Malaysia
: email;internet: ahy...@tm.net.my
: x-mozilla-cpt: ;0
: x-mozilla-html: FALSE
: version: 2.1
: end: vcard

...(second copy of signature deleted)...

Your signature is really long... If you have such a long signature, you
should not include it twice in your posting :-)

ciao,
Juergen Ilse (il...@asys-h.de)


Jon Plews

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to


Scott Johnson <sj_n...@nospam.aracnet.com> wrote in article
<34FCF2...@nospam.aracnet.com>...
[ snip ]


>
> It probably should be mentioned, however, that calling a Unix binary
> *.exe will NOT make it run on Windoze, even if compiled for an Intel
> processor. (Nor would renaming the output of a Windoze compiler to
> "a.out" make it run on a Unix system...though some Unices available for
> PC are known to run DOS/Windoze binaries with add-on packages...)
>

Yes--but you could cross-compile it for Win32.

> The binary file formats commonly used by Unices (a.out, ELF, etc.) are
> rather different than the binary format used by Windoze. Plus the
> libraries are different, etc and so on.
>

GCC can compile/cross compile for _many_ platforms including Win32 and
binutils linker can link more formats than you can shake a shitty stick at.

> Scott, who is wondering if ld.so would complain if he renamed all his
> shared libraries *.dll :)
>

Could be done ...

Jon.

Paul Hughett

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

firewind (fire...@metroid.dyn.ml.org) wrote:

: On 3 Mar 1998, Paul Hughett wrote:

: > Unix was developed on 10 character-per-second teletypes, and some of the
: > habits formed then are still with us.

: Explain how Unix's sensible approach to executable files has anything to
: do with teletypes.

Why type 7 characters when 3 will do? Certainly you've noticed that Unix
commands tend to be as terse as possible, if not terser. Having to type
them on a slow teletype with a rather stiff keyboard certainly encouraged
that tendency, although I won't argue with you that it is a sensible
approach.

Paul Hughett

Adam

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

Yes you can rename it to anything you want.. .EXE is fine, it doesn't
matter, as long as you've made it an executable

in fact, the output of a compile doesn't have to be a.out, you can specify
the name you want it to be.. just add a +ACIAPg- blah.exe+ACI- at the end of your cc
command line.

Regards,
Adam
mailto:adamt+AEA-genasys.com.au

ahyeop wrote in message +ADw-34FAC96E.4CFF519+AEA-tm.net.my+AD4-...
+AD4-Two questions :
+AD4-1. Can I rename unixes 'a.out' into .EXE ?
+AD4-2. Can I change 'a.out' to my own prefered names and will it works
+AD4-w/out any hitch ?
+AD4-
+AD4-Thanks for the help :-)
+AD4-Ahyeop, Malaysia
+AD4-ahyeop4+AEA-tm.net.my

Kaz Kylheku

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

In article <6dht8f$6u$1...@netnews.upenn.edu>,

Paul Hughett <hug...@chaplin.med.upenn.edu> wrote:
>Unix was developed on 10 character-per-second teletypes, and some of the
>habits formed then are still with us.

If you are referring to the short commands, consider that, despite the
increase in terminal speeds, the speed of typing rarely gets beyond 10
characters per second or so, if that fast. If you can manage sustained periods
of 10 cps typeing, you are indeed a virtuoso typist.

UNIX was developed by and for the same 10 cps fingers that we still have
today.

Though once upon a time, interrupt overhead may have been an issue as well.
Each time you type a character, it has to be transmitted from the terminal to
the host. The host is interrupted, which triggers a complex chain of events
just to get that character buffered in the kernel and echoed. On ancient slow
machines, this overhead was significant to detract from the processing of
tasks, particularly with a lot of terminals! Thus a name like 'ls' rather than
'listfiles' would trigger fewer interrupts and less overhead. But I firmly
believe that the ease of typing, rather than overhead concerns, is the main
motivation.

Christopher Browne

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

On 4 Mar 1998 01:46:48 GMT, Will Rose <c...@cts.com> wrote:
>Too young to remember, also, that CP/M (of blessed memory) didn't
>have .exe files. It had only .COM files, and .SUB scripts. But
>I don't know where the naming came from; some of CP/M apparently
>came from TOPS, but I'm too young to remember TOPS.

I *know* that CP/M used .COM files; I just didn't bother to mention
it...

--
The *Worst* Things to Say to a Police Officer: Hey, is that a 9 mm?
That's nothing compared to this .44 magnum.
cbbr...@hex.net - <http://www.hex.net/~cbbrowne/lsf.html>

Jerry Coffin

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

In article <88897611...@optional.cts.com>, c...@cts.com says...

[ followups trimmed somewhat, as this seems to have nothing to do with
C, though I'll admit the relationship to Linux is pretty weak too. ]

> Too young to remember, also, that CP/M (of blessed memory) didn't
> have .exe files. It had only .COM files, and .SUB scripts. But
> I don't know where the naming came from; some of CP/M apparently
> came from TOPS, but I'm too young to remember TOPS.

Actually, CP/M was derived almost directly from DEC RT-11 rather than
TOPS. Given that both were from DEC at around the same time, I s'pose
it's possible that TOPS had _some_ of the same characteristics as RT-
11, but offhand I can't think of many beyond things like cryptic error
messages and poorly named commands that were shared with nearly every
other OS in existence at the time.

--
Later,
Jerry.

The Universe is a figment of its own imagination.

Jae

unread,
Mar 9, 1998, 3:00:00 AM3/9/98
to

On 3 Mar 1998, Frank Sweetser wrote:

> > Two questions :


> > 1. Can I rename unixes 'a.out' into .EXE ?

> > 2. Can I change 'a.out' to my own prefered names and will it works

> > w/out any hitch ?

gcc -o <output file name> <source code file names>

ie - gcc -o test.exe test.c

that will compile the program as test.exe - umm - if I have the -o wrong,
it's something else. I'm pretty sure that's what it is. I've been working
in Perl lately and haven't compiled any C progs in a while, but I'm pretty
sure that's what it is.


--Jae


Kai Henningsen

unread,
Mar 14, 1998, 3:00:00 AM3/14/98
to

sj_n...@nospam.aracnet.com (Scott Johnson) wrote on 03.03.98 in <34FCF2...@nospam.aracnet.com>:

> The binary file formats commonly used by Unices (a.out, ELF, etc.) are
> rather different than the binary format used by Windoze. Plus the
> libraries are different, etc and so on.

Actually, I understand that the Win32 .EXE format is essentially a wrapper
around COFF.

Kai
--
Internet: k...@khms.westfalen.de
Bang: major_backbone!khms.westfalen.de!kai
http://www.westfalen.de/private/khms/

0 new messages