希望这会有所帮助,但会得到一个不同的错误.
尝试将以下内容编译为hello.cs
using Gtk;
using System;
class Hello
{
static void Main()
{
Application.Init();
Window window = new Window("helloworld");
window.Show();
Application.Run();
}
}
Run Code Online (Sandbox Code Playgroud)
使用以下命令编译"gmcs hello.cs -pkg:gtk-sharp-2.0"
根据命令提示符,我收到cs0006(单声道cp)或cs2001(win cp)说无法从单声道cp找到文件它说无法从win cp找到元数据文件它说源文件不能发现
这是一个示例:
c:\Users\Stephen Lloyd\Desktop>gmcs hello.cs -pkg:gtk-sharp-2.0
-r:C:/Program Files \(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/pango-sharp.dll \(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/atk-sharp.dll \(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/gdk-sharp.dll \(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/gtk-sharp.dll \(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/glib-sharp.dll
error CS2001: Source file `Files' could not be found
error CS2001: Source file `\(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/pango-sharp.dll' could not be found
error CS2001: Source file `\(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/atk-sharp.dll' could not be found
error CS2001: Source file `\(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/gdk-sharp.dll' could not be found
error …Run Code Online (Sandbox Code Playgroud) 我使用以下命令在我的64位Windows 7上安装了mono:
在目录中(路径中没有空格)根据Jim Gomes的建议改变了
成功运行前两个示例
来自Mono Basics的文章.
但是三维示例"WinForms Hello World"编译时没有错误,并且从Windows(通过双击Windows资源管理器)成功运行但运行:
mono hello.exe
Run Code Online (Sandbox Code Playgroud)
从"Mono-3.2.3命令提示符"窗口生成下面列出的错误(请注意,前两个示例包括第二个示例的窗口是从命令提示符调用成功启动的mono ...)
有什么问题以及如何克服它?
更新
根据上面提到的文章"单声道基础知识"我编写了三维示例"Winforms Hello World" gmcs hello.cs -pkg:dotnet.
顺便说一下,dotnet包裹在哪里?
它在同名目录中吗?dotnet在Mono-3.2.3目录下我没有一个具有这个名字的单一目录
mono hello.exe从"Mono-3.2.3命令提示符" 运行产生的错误
Unhandled Exception:
System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException:
An exception was thrown by …Run Code Online (Sandbox Code Playgroud)