简体   繁体   中英

Compile C# code with code runner with Mono

I am trying to compile this simple C# code on OS X:

using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("hello");
    }
}

This was the code runner template.

I have installed Mono, and the run command is mono $compiler. I first tried using the default Compile.sh file, and it didn't work, so I've found on the web a guide that says to write a shell script like this one:

enc[4]="UTF8"           # UTF-8
enc[10]="UTF16"         # UTF-16
enc[5]="ISO8859-1"      # ISO Latin 1
enc[9]="ISO8859-2"      # ISO Latin 2
enc[30]="MacRoman"      # Mac OS Roman
enc[12]="CP1252"        # Windows Latin 1
enc[3]="EUCJIS"         # Japanese (EUC)
enc[8]="SJIS"           # Japanese (Shift JIS)
enc[1]="ASCII"          # ASCII
file=$1
file=${file/\.cs/\.exe}


mcs "$1"
echo "$file"
exit 0

So I've changed it (backup-ed the old one), but I still get this error on the console:

bash: Run Command: No such file or directory

除非您特别需要从命令行进行编译,否则我强烈建议您使用MonoDevelop,而不是尝试找出适当的命令行参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM