First Attempts at Mono / C# on Windows

I’ve been attempting for the past day to get this simple code example from Miguel de Icaza to work. It uses the Gecko rendering engine from Mozilla to take a snapshot of a web page. Seems like it should be fairly easy, right? Well, let’s see:

Where to get the Gtk# and Gecko# libraries? From Mono, I suppose – since Miguel de Icaza is or was a Mono contributor. Fine, so I get the latest stable build of Mono (1.2.5.2) from mono-project.com, install it locally, and then fire up a text editor to do the recommended HelloWorld test:

using System;
using Gtk;
 
public class GtkHelloWorld {
 
public static void Main() {
Console.WriteLine("HelloWorld");
}
 
}

That compiles fine using the sample command line:

mcs -pkg:gtk-sharp-2.0 helloworld.cs

And when I run it, I get the expected output with no errrors. However, when I try the de Icaza code, which includes the additional reference:

using Gecko;

it doesn’t compile. OK, no problem. I’ll take a guess at the name of the package I’m missing and add the package to the compile command:

mcs -pkg:gtk-sharp-2.0 -pkg:gecko-sharp-2.0 x.cs

(note: source file name changed to x.cs)

.. and I get a successful compile (apparently, as there is no feedback — I (heart) *NIX. Not!).

However, when I run the newly-compiled x.exe, I get this error:

Wait a minute. Why did it compile if it couldn’t find the required libraries? It’s probably some dumb PATH problem. However, I can’t seem to locate *ANY* file in the mono distro called gtk-sharp*.dll.

… so I’m momentarily stumped.

Leave a comment




TwitterCounter for @anthonyrstevens
Add to Technorati Favorites

RSS Feed

View Anthony Stevens's profile on LinkedIn