CodeRunner 2 中的 C# 程序集
C# Assembly in CodeRunner 2
我正在使用 CodeRunner 2 (2.0.3),但无法在 C# 中编译代码。我收到警告:
/Users/Username/Library/Application Support/CodeRunner/Languages/C#.crLanguage/Scripts/compile.sh: line 25: gmcs: command not found
In order to run C# code, you need to have Mono installed. You can get it at http://mono-project.com
我安装了 Mono, I installed Xamarin Studio and tried it through that as well. Some basic things work so I know Mono is there. I have restarted my computer, restarted CodeRunner, etc. I have done a few things in other Whosebug answers and still doesn't work. I am attempting to run a simple URL request from THIS 示例。感谢任何帮助。
提前致谢!
~已解决~
谢谢@clay-fowler
1.开码运行ner
2. 将语言设置为 C#
3. 粘贴:
using System;
class Untitled
{
static void Main(string[] args)
{
Console.Write ("Hello");
}
}
4. 转到代码运行ner -> 首选项 -> 语言 -> C#
5. 在设置选项卡下,单击编辑脚本...
6. 将 gmcs 更改为 mcs(第 25 行)
7. 现在应该是这样的:
compname=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*//'`.exe
mcs "$CR_FILENAME" "${@:1}"
status=$?
if [ $status -eq 0 ]
then
echo $compname
exit 0
elif [ $status -eq 127 ]
then
echo -e "\nIn order to run C# code, you need to have Mono installed. You can get it at http://mono-project.com"
fi
exit $status
8.运行程序
此错误意味着 CodeRunner 找不到 Mono 的二进制文件之一,它应该在您的 $PATH 上找到:
gmcs: command not found
gmcs 是 Mono C# 编译器,但它是比当前版本更旧版本的旧名称。现代 Mono 总是使用名为 "mcs" 的编译器。 gmcs 应该只是一个 shell 脚本,它运行 mcs 以实现向后兼容性。它也是从 /usr/bin 到 /Library/Frameworks 的符号链接。像这样:
/usr/bin/gmcs -> /Library/Frameworks/Mono.framework/Commands/gmcs
但是,在一些最近的 Mono 发行版中,它没有在 Mac OS X 上正确部署。在我的例子中,/Library/Frameworks/Mono。framework/Commands/gmcs不存在!也许对你也一样。
因此,要简单地解决此问题并自己获取东西 运行,您可能只想更改符号链接以指向 mcs?
sudo ln -s /usr/bin/gmcs /Library/Frameworks/Mono.framework/Commands/mcs
这有点丑陋,会让您的系统变脏。只修改 CodeRunner 的 compile.sh 以使用 mcs 而不是 gmcs 会不那么难看。这不是 完全 等效的,因为 gmcs shell 脚本实际上使用一些可选参数调用 mcs 使其表现得像一个旧的编译器,但对于你做 CodeRunner 的情况它可能是无害的。
我正在使用 CodeRunner 2 (2.0.3),但无法在 C# 中编译代码。我收到警告:
/Users/Username/Library/Application Support/CodeRunner/Languages/C#.crLanguage/Scripts/compile.sh: line 25: gmcs: command not found
In order to run C# code, you need to have Mono installed. You can get it at http://mono-project.com
我安装了 Mono, I installed Xamarin Studio and tried it through that as well. Some basic things work so I know Mono is there. I have restarted my computer, restarted CodeRunner, etc. I have done a few things in other Whosebug answers and still doesn't work. I am attempting to run a simple URL request from THIS 示例。感谢任何帮助。
提前致谢!
~已解决~ 谢谢@clay-fowler
1.开码运行ner
2. 将语言设置为 C#
3. 粘贴:
using System;
class Untitled
{
static void Main(string[] args)
{
Console.Write ("Hello");
}
}
4. 转到代码运行ner -> 首选项 -> 语言 -> C#
5. 在设置选项卡下,单击编辑脚本...
6. 将 gmcs 更改为 mcs(第 25 行)
7. 现在应该是这样的:
compname=`echo "$CR_FILENAME" | sed 's/\(.*\)\..*//'`.exe
mcs "$CR_FILENAME" "${@:1}"
status=$?
if [ $status -eq 0 ]
then
echo $compname
exit 0
elif [ $status -eq 127 ]
then
echo -e "\nIn order to run C# code, you need to have Mono installed. You can get it at http://mono-project.com"
fi
exit $status
8.运行程序
此错误意味着 CodeRunner 找不到 Mono 的二进制文件之一,它应该在您的 $PATH 上找到:
gmcs: command not found
gmcs 是 Mono C# 编译器,但它是比当前版本更旧版本的旧名称。现代 Mono 总是使用名为 "mcs" 的编译器。 gmcs 应该只是一个 shell 脚本,它运行 mcs 以实现向后兼容性。它也是从 /usr/bin 到 /Library/Frameworks 的符号链接。像这样:
/usr/bin/gmcs -> /Library/Frameworks/Mono.framework/Commands/gmcs
但是,在一些最近的 Mono 发行版中,它没有在 Mac OS X 上正确部署。在我的例子中,/Library/Frameworks/Mono。framework/Commands/gmcs不存在!也许对你也一样。
因此,要简单地解决此问题并自己获取东西 运行,您可能只想更改符号链接以指向 mcs?
sudo ln -s /usr/bin/gmcs /Library/Frameworks/Mono.framework/Commands/mcs
这有点丑陋,会让您的系统变脏。只修改 CodeRunner 的 compile.sh 以使用 mcs 而不是 gmcs 会不那么难看。这不是 完全 等效的,因为 gmcs shell 脚本实际上使用一些可选参数调用 mcs 使其表现得像一个旧的编译器,但对于你做 CodeRunner 的情况它可能是无害的。