inohilog

/var/log/inohiro.log

System.Console.ReadKeyメソッドは.NET2からなんですね

なんの変哲も無いHello, Worldなコードを書いて無意識のうちにmcs(Mono C# Compiler(1.x))でコンパイルしよとしたら、ReadKeyメソッドないよって言われた。

public class Hello
{
	static void Main( string[] args )
	{
		System.Console.WriteLine( "Hello, World" );
		System.Console.ReadKey();
	}
}

これをmcs でコンパイル

inohiro-mac:Desktop inohiro$ mcs hello.cs 
hello.cs(6,32): error CS0117: `System.Console' does not contain a definition for `ReadKey'
/opt/local/lib/mono/1.0/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

「gmcs」でコンパイルしてね、と教えてくれたらいいのに。

inohiro-mac:02-081212 inohiro$ mcs CellularAutomata.cs
CellularAutomata.cs(32,43): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
CellularAutomata.cs(32,68): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
CellularAutomata.cs(34,37): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
CellularAutomata.cs(34,61): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
CellularAutomata.cs(50,37): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
CellularAutomata.cs(50,62): error CS1644: Feature `generics' is not available in Mono mcs1 compiler. Consider using the `gmcs' compiler instead
Compilation failed: 6 error(s), 0 warnings
inohiro-mac:02-081212 inohiro$ 

こんな感じで。

追記

「mcs」を「gmcs」にエイリアスしとけばいいか。