Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot compile hello.cs for gtk# using mono command prompt

Tags:

mono

Had hoped that this would help, but getting a different error.

attempting to compile the following as hello.cs

using Gtk;
using System;
class Hello
{
    static void Main()
    {
        Application.Init();
        Window window = new Window("helloworld");
        window.Show();
        Application.Run();
    }
}

Compiling with the following command "gmcs hello.cs -pkg:gtk-sharp-2.0"

depending on the command prompt, I'm receiving either cs0006 (mono cp) or cs2001 (win cp) saying that files cannot be found from mono cp it says that the metadata file cannot be found from win cp it says that source file cannot be found

Here's a sample:

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 CS2001: Source file `\(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/gtk-sharp.dll' could not be found
error CS2001: Source file `\(x86\)/Mono-2.10.8/lib/mono/gtk-sharp-2.0/glib-sharp.dll' could not be found
Compilation failed: 6 error(s), 0 warnings

In all cases the referenced .dlls are in that folder.

Any thoughts?

like image 300
Stephen Lloyd Avatar asked Nov 04 '22 06:11

Stephen Lloyd


2 Answers

-pkg is broken on Windows; you will need to supply individual individual -r[eference]:s. Please see this answer for details.

like image 84
aib Avatar answered Nov 09 '22 05:11

aib


As an alternative to manually entering references, I found it easier to just install mono to a path with no spaces aka C:\devtools\mono and then adding the ... C:\devtools\mono\bin to your path. The command was then successful for me. As an aside I have had a similar problem before with using unix devtools on windows and this has worked there as well.

like image 22
Zachary Moshansky Avatar answered Nov 09 '22 05:11

Zachary Moshansky