Nick,

 

I tried to install GTK# but I haven’t been able to.� Do I have to actually compile the GTK# source files?� Is there an installable executable that I can run which will properly install GTK# on my computer?

 

I’m running this on Windows 2000 with the .NET Service Pack 1 installed.

 

Amrit

 

----

Amrit Kohli

[EMAIL PROTECTED]

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nick Loeve
Sent: Tuesday, October 12, 2004 9:33 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [Mono-list] HelloWorld.cs

 

try compiling with:

msc -pkg:gtk-sharp helloworld.cs

Thats assuming you have GTK# installed....


On 13/10/2004, at 10:50 AM, Amrit Kohli wrote:

I am still learning mono and C#, so forgive me what is probably a very easy question for most of you.

 

I entered the following code from a HelloWorld type of application:

 

// helloworld.cs - Gtk# Tutorial example

 

namespace GtkSharpTutorial {

      using Gtk;

      using GtkSharp;

      using System;

      using System.Drawing;

 

 

      public class helloworld {

 

            /* This is a callback function. The data arguments are ignored

             * in this example. More on callbacks below. */

            static void hello (object obj, EventArgs args)

            {

                  Console.WriteLine("Hello World");

                  Application.Quit ();

            }

 

            static void delete_event (object obj, DeleteEventArgs args)

            {

                  /* If you return FALSE in the "delete_event" signal handler,

                   * GTK will emit the "destroy" signal. Returning TRUE means

                   * you don't want the window to be destroyed.

                   * This is useful for popping up 'are you sure you want to quit?'

                   * type dialogs. */

 

                      Console.WriteLine ("delete event occurred\n");

                      Application.Quit ();

            }

 

            public static void Main(string[] args)

            {

                  /* This is called in all GTK applications. Arguments are parsed

                   * from the command line and are returned to the application. */

                  Application.Init ();

 

                  /* create a new window */

                  Window window = new Window ("helloworld");

                  /* When the window is given the "delete_event" signal (this is given

                   * by the window manager, usually by the "close" option, or on the

                   * titlebar), we ask it to call the delete_event () function

                   * as defined above. The data passed to the callback

                   * function is NULL and is ignored in the callback function. */

 

                  window.DeleteEvent += new DeleteEventHandler (delete_event);

   

                  /* Sets the border width of the window. */

                  window.BorderWidth = 10;

                  /*  gtk_container_set_border_width (GTK_CONTAINER (window), 10);*/

   

                  /* Creates a new button with the label "Hello World". */

                  Button btn = new Button ("Hello World");

   

                  /* When the button receives the "clicked" signal, it will call the

                   * function hello() passing it NULL as its argument.  The hello()

                   * function is defined above. */

                  btn.Clicked += new EventHandler (hello);

 

      

                  /* This packs the button into the window (a gtk container). */

                  window.Add (btn);

 

                  /* The final step is to display this newly created widget. */

                  window.ShowAll ();

   

 

                  /* All GTK applications must have a gtk_main(). Control ends here

                  * and waits for an event to occur (like a key press or

                  * mouse event).

                  * In C#, we use Application.Run(), as used in Windows.Forms*/

 

                  Application.Run ();

   

                  }

      }

 

}

 

 

When I tried to compile it, I got the following errors:

 

helloworld.cs(20) error CS0246: Cannot find type `DeleteEventArgs'

helloworld.cs(4) error CS0246: The namespace `Gtk' can not be found (missing assembly reference?)

    Try using -r:gtk-sharp

helloworld.cs(5) error CS0246: The namespace `GtkSharp' can not be found (missing assembly reference?)

    Try using -r:gtk-sharp

helloworld.cs(7) error CS0246: The namespace `System.Drawing' can not be found (missing assembly reference?)

    Try using -r:System.Drawing

Compilation failed: 4 error(s), 0 warnings

 

 

So, I tried to do :

 

      

mcs –r:gtk-sharp helloworld.cs

 

That produced the error message:

 

error CS0006: Cannot find assembly `gtk-sharp'

Log:

 

Compilation failed: 1 error(s), 0 warnings

 

 

How do I install the GTK libraries?  I am using mono v1.0.2 for windows.  I’m guessing from the little bit of research I’ve done that I have to compile the GTK# source into an “assembly” or binary.  Also, where would I put the GTK libraries when I finally do install them?

 

Thanks,

 

Amrit

----

Amrit Kohli

[EMAIL PROTECTED]

 

Reply via email to