site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Welcome to the list. On Nov 27, 2004, at 15:55, Josef Vukovic wrote: [snip] Hope that helps. Regards, Justin _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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" 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. 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 *--------------------------------------*-------------------------------* This email sent to site_archiver@lists.apple.com
participants (1)
-
Justin Walker