web-dev-qa-db-fra.com

Comment puis-je compiler mono Hello World?

J'ai Ubuntu 11.04 avec ce mono:

Mono JIT compiler version 2.6.7 (Debian 2.6.7-5ubuntu3)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC and Parallel Mark)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none

J'essaie de lancer ceci:

using System;

public class HelloWorld
{
    static public void Main ()
    {
        Console.WriteLine ("Hello Mono World");
    }
}

et j'obtiens ces erreurs:

ThinkPad-X201-Tablet:~/Desktop$ gmcs hello.cs
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: The class System.Runtime.CompilerServices.CompilerGeneratedAttribute could not be loaded, used in gmcs
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Missing method .ctor in Assembly /usr/lib/mono/2.0/gmcs.exe, type System.Runtime.CompilerServices.CompilerGeneratedAttribute
** (/usr/lib/mono/2.0/gmcs.exe:9128): WARNING **: Can't find custom attr constructor image: /usr/lib/mono/2.0/gmcs.exe mtoken: 0x0a0003d2
Unhandled Exception: System.TypeLoadException: A type load exception has occurred.

Des idées?

2
Danpe

Compile sans faille sur mon installation.

Vous devriez avoir ce paquet installé:

  • mono-2.0-devel

Cela devrait dessiner toutes les dépendances requises pour une compilation en ligne de commande. Si vous voulez plus de confort, je vous recommande d'installer le package monodevelop.

3
aquaherd