单声道gtk你好世界失败,'失踪的方法'

cop*_*tic 7 gtk mono gtk#

我是第一次尝试单声道.以下是我设置它的步骤.

在VirtualBox中安装了Kubuntu 12.04 LTS

apt-get install mono-complete gtk-sharp2
Run Code Online (Sandbox Code Playgroud)

然后我尝试在本教程中运行hello world应用程序.

http://www.mono-project.com/Mono_Basics

命令行应用程序运行正常.

我按照说明使用以下命令编译了GTK应用程序:

gmcs hello.cs -pkg:gtk-sharp-2.0
Run Code Online (Sandbox Code Playgroud)

当我运行应用程序时,它失败并出现以下错误:

Missing method System.Type::op_Inequality(Type,Type) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
  at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
  at Hello.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
  at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
  at Hello.Main () [0x00000] in <filename unknown>:0
Run Code Online (Sandbox Code Playgroud)

对我来说,单声道库看起来与gtk-sharp库不兼容.

有没有人对如何使这个工作有任何建议?

Mar*_*far 22

所有12.04版Ubuntu版本都有Mono默认为4.0配置文件(类似于.NET 4.0).您正在使用gmcs编译器编译您的hello.cs,该编译器旨在定位2.0配置文件(类似于.NET 2.0).

使用dmcs编译器而不是gmcs,错误将消失.