感谢您阅读我的问题。我对 C# 和 mono 非常非常陌生。我想为 .Net 学习 C#,但由于我有 Mac 并且没有 Windows,我无法下载 Visual Studio Express 等。我听说过 mono 并安装了它,但这些说明对我来说很难遵循,而且不是确定我是否还没有下载所有内容,是否将内容存储在错误的位置,或者什么,但我无法编译一个简单的 Hello World。
我下载然后安装了 MonoFramework-MDK-2.10.9_11.macos10.xamarin.x86
My-MacBook-Pro:~$ gmcs --version
Mono C# compiler version 2.10.9.0
My-MacBook-Pro:~$ mono --version
Mono JIT compiler version 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: kqueue
Architecture: x86
Disabled: none
Misc: debugger softdebug
LLVM: yes(2.9svn-mono)
GC: Included Boehm (with typed GC)
为了测试安装,我按照http://www.mono-project.com/Mono_Basics上的 Hello World 说明进行操作
然后我得到了82个错误!
这是我在终端 bash 窗口中输入的内容:
My-MacBook-Pro:~$ gmcs hello.cs
hello.cs(1,0): error CS1525: Unexpected symbol `{'
hello.cs(1,5): error CS1009: Unrecognized escape sequence `\c'
hello.cs(1,5): error CS1009: Unrecognized escape sequence `\c'
hello.cs(3,2): error CS1009: Unrecognized escape sequence `\c'
hello.cs(3,12): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,12): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,34): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,34): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,52): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,52): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,74): error CS1009: Unrecognized escape sequence `\g'
hello.cs(3,74): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,2): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,2): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,23): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,23): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,42): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,42): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,62): error CS1009: Unrecognized escape sequence `\g'
hello.cs(4,62): error CS1009: Unrecognized escape sequence `\g'
hello.cs(5,1): error CS1009: Unrecognized escape sequence `\m'
hello.cs(5,1): error CS1009: Unrecognized escape sequence `\m'
hello.cs(5,1): error CS1009: Unrecognized escape sequence `\m'
hello.cs(5,1): error CS1009: Unrecognized escape sequence `\m'
hello.cs(5,1): error CS1009: Unrecognized escape sequence `\m'
hello.cs(6,1): error CS1009: Unrecognized escape sequence `\d'
hello.cs(7,1): error CS1009: Unrecognized escape sequence `\p'
hello.cs(7,1): error CS1009: Unrecognized escape sequence `\p'
hello.cs(7,1): error CS1009: Unrecognized escape sequence `\p'
hello.cs(7,1): error CS1009: Unrecognized escape sequence `\p'
hello.cs(9,10): error CS1009: Unrecognized escape sequence `\c'
hello.cs(9,14): error CS1009: Unrecognized escape sequence `\c'
hello.cs(10,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(10,6): error CS1525: Unexpected symbol `cf4'
hello.cs(10,12): error CS1009: Unrecognized escape sequence `\c'
hello.cs(10,16): error CS1009: Unrecognized escape sequence `\c'
hello.cs(10,26): error CS1009: Unrecognized escape sequence `\c'
hello.cs(10,30): error CS1009: Unrecognized escape sequence `\
'
hello.cs(10,30): error CS1009: Unrecognized escape sequence `\
'
hello.cs(10,33): error CS1012: Too many characters in character literal
hello.cs(12,6): error CS1009: Unrecognized escape sequence `\c'
hello.cs(13,2): error CS1525: Unexpected symbol `
10'
hello.cs(13,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(14,6): error CS1009: Unrecognized escape sequence `\c'
hello.cs(15,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(15,6): error CS1525: Unexpected symbol `cf4'
hello.cs(15,12): error CS1009: Unrecognized escape sequence `\
'
hello.cs(15,12): error CS1009: Unrecognized escape sequence `\
'
hello.cs(15,26): error CS1009: Unrecognized escape sequence `\{'
hello.cs(15,26): error CS1009: Unrecognized escape sequence `\{'
hello.cs(15,31): error CS1009: Unrecognized escape sequence `\
'
hello.cs(16,6): error CS1009: Unrecognized escape sequence `\c'
hello.cs(17,2): error CS1525: Unexpected symbol `
10'
hello.cs(17,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(18,6): error CS1009: Unrecognized escape sequence `\c'
hello.cs(19,2): error CS1525: Unexpected symbol `
10'
hello.cs(19,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(20,6): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,7): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,17): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,23): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,27): error CS1009: Unrecognized escape sequence `\
'
hello.cs(21,33): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,37): error CS1009: Unrecognized escape sequence `\{'
hello.cs(21,37): error CS1009: Unrecognized escape sequence `\{'
hello.cs(21,42): error CS1009: Unrecognized escape sequence `\
'
hello.cs(21,57): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,68): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,72): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,85): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,90): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,112): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,118): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,122): error CS1009: Unrecognized escape sequence `\
'
hello.cs(21,129): error CS1009: Unrecognized escape sequence `\c'
hello.cs(21,133): error CS1009: Unrecognized escape sequence `\}'
hello.cs(21,133): error CS1009: Unrecognized escape sequence `\}'
hello.cs(21,138): error CS1009: Unrecognized escape sequence `\
'
hello.cs(21,138): error CS1009: Unrecognized escape sequence `\
'
hello.cs(21,141): error CS1012: Too many characters in character literal
hello.cs(22,1): error CS1009: Unrecognized escape sequence `\c'
hello.cs(22,5): error CS1009: Unrecognized escape sequence `\}'
Compilation failed: 82 error(s), 0 warnings
这是我的 hello.cs 文件包含的内容:
using System;
public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello Mono World");
}
}
我将http://www.mono-project.com/Mono_Basics提供的内容复制并粘贴到 TextEdit 中,并将文件创建为 .rtf,然后将扩展名更改为 .cs
有人能告诉我我做了什么(或没做什么)来制造这个烂摊子吗?谢谢。