[Gtk-sharp-list] Trouble compiling GTK# on Win32 using .NET 2.0

Brad Taylor brad at getcoded.net
Tue Mar 20 13:29:32 EDT 2007


> I had trouble compiling Gtk# 2.0.10 on my machine.

A word to the wise, Gtk# 2.10.0 (I assume that what you meant) is known
not to work on Windows due to
http://bugzilla.ximian.com/show_bug.cgi?id=79993, so compiling Gtk# 2.8
might be a safer bet at least until that is fixed.

> Because I didn't find any binary packages for GTK# that run in
> the .NET 2.0 environment, I decided to build from source.  I opened up
> a Cygwin window and added following directories to the PATH
> environment variable:


> generated\CairoHelper.cs(15,37): error CS0246: The type or namespace
> name 'Cairo' could not be found (are you missing a using directive or
> an assembly reference?)
> I understand that most of you use Mono instead of Microsoft's runtime,
> but if anyone recognizes the errors, I would appreciate any tips.

Gtk# (> 2.6, I believe) requires Mono.Cairo to be installed.  You'll
need to either build mono on Windows, or copy both
$PREFIX/lib/mono/1.0/Mono.Cairo.dll and
$PREFIX/lib/pkgconfig/mono-cairo.pc over to your host system.  Also make
sure to change mono-cairo.pc's "Libs:" line to the correct Windows path
to Mono.Cairo.dll.  For instance, here is what I do:

In Cygwin:

scp user at host:/usr/local/lib/mono/1.0/Mono.Cairo.dll \
scp user at host:/usr/local/lib/pkgconfig/mono-cairo.pc \

Then, I change the last line in mono-cairo.pc to read:

Libs: -r:C:/cygwin/opt/gtk/lib/mono/1.0/Mono.Cairo.dll

It's quite important that you make Libs the correct *Windows* path,
since the Libs path will be sent to csc.exe.



Brad Taylor

More information about the Gtk-sharp-list mailing list