感谢您阅读我的问题。 我对C#和单声道非常非常新。我想为.Net学习C#,但由于我有一台Mac而且没有窗户,我无法下载Visual Studio Express等。我听说过单声道并安装了它,但说明书很难让我遵循,而不是确定如果我没有下载所有内容,如果我将内容存储在错误的位置,或者是什么,但我无法编译简单的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个错误!
这是我在terminal-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
有人能告诉我我做了什么(或没做过)创造这个混乱?谢谢。
答案 0 :(得分:18)
我将http://www.mono-project.com/Mono_Basics提供的内容完全复制并粘贴到TextEdit中,然后将文件创建为.rtf,然后将扩展名更改为.cs
是的,不要那样做。将其创建为纯文本文件。 RTF不是纯文本。当在RTF查看器/编辑器中显示时,它可能看起来像一样纯文本,但你所做的是本质上与在Word中创建文件相同,然后期待{{ 1}}阅读Word文档。
它必须是纯文本文件,其内容如示例所示。
答案 1 :(得分:2)
我认为这是问题所在:
as an .rtf then changed the extension to .cs
尝试在某些基本文本编辑器中编辑cs文件。