Re: Preprocesor?
Re: Preprocesor?
- Subject: Re: Preprocesor?
- From: Justin Walker <email@hidden>
- Date: Sat, 27 Nov 2004 16:19:57 -0800
Welcome to the list.
On Nov 27, 2004, at 15:55, Josef Vukovic wrote:
Hello all,
I am an non professional subscriber, and want to test my subscription
to this list with a
Question. here it is:
[snip]
I made a small C-Programm with the Textedit app. save it and,
When compiling with cc in the terminal then I get the error message
"bad magic number not a Mach-0 file"
[snip]
The C compiler has a convention that if it sees a file name with an
extension it does not recognize, it passes the file to the linker. The
message you saw,
ld: foo.c.rtf bad magic number (not a Mach-O file)
indicates that this is what happened.
I will guess that the file that you wanted to compile is called
something like "foo.rtf", in which case, the compiler passed that file
directly to the linker. The linker ("ld") is expecting a Mach-O file
(an executable, in some form or other), and checked the beginning of
the file to verify this. Since it is an RTF file, not the output of
the assembler/compiler, it complained.
When you used emacs, you probably called the file "foo.c", so things
worked as expected.
I would suggest this:
- only provide plain-text source to the compiler (regardless of what
you read
in the documentation, I don't think the compiler itself will be
happy with
RTF.
- always name your source files with an extension that indicates the
language
you are using (".c" for C; ".cc" or ".cpp" for C++; etc. There are
generally
well-accepted extensions for these files, so it makes sense to
follow those
conventions.)
- you could try feeding the compiler a .rtf file as source by using
Xcode; I have
not tried this, but it's possible that the IDE will be aware of how
to deal
with RTF. In general, however, there is no good reason to use RTF
for source
code. It adds nothing to the content of the file, and the
resulting file is
larger than needed.
In addition, for future questions for the list, including the *full*
error message(s) will help in determining what the problem is.
Hope that helps.
Regards,
Justin
PS: for mail to mailing lists such as this, please set your mailer to
send plain-text, rather than RTF or HTML. It makes the mail much more
readable (despite how attractive it may look to you).
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | "Weaseling out of things is
what
| separates us from the animals.
| Well, except the weasel."
| - Homer J Simpson
*--------------------------------------*-------------------------------*
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Preprocesor? (From: Josef Vukovic <email@hidden>) |