J
James Coburn's Grey Helmet Hair
When I try to compile my GTK# app, the compiler says:
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -r -o
buttons.exe
error CS2001: Source file 'buttons.exe' could not be opened
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o
buttons.exe
buttons.cs(8) error CS0246: The namespace `System.Drawing' can not be found
(missing assembly reference?)
Try using -r:System.Drawing
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o
buttons.exe -r:System.Drawing
error CS0006: Cannot find assembly `System.Drawing'
Log:
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono>
here's the source code:
//buttons.cs
namespace GtkSharpTutorial {
using Gtk;
using GtkSharp;
using System;
using System.Drawing;
public class buttons
{
/* Create a new hbox with an image and a label packed into it
* and return the box. */
static Widget xpm_label_box(string xpm_filename, string label_text )
{
/* create box for image and label */
HBox box = new HBox(false, 0);
box.BorderWidth = 2;
/* Now on to the image stuff */
Gtk.Image image = new Gtk.Image(xpm_filename);
/* Create a label for the button */
Label label = new Label (label_text);
/* Pack the image and label into the box */
box.PackStart( image, false, false, 3);
box.PackStart( label, false, false, 3);
image.Show();
label.Show();
return box;
}
/* Our usual callback function */
static void callback( object obj, EventArgs args)
{
Console.WriteLine("Hello again - cool button was pressed");
}
/* another callback */
static void delete_event(object obj, DeleteEventArgs args)
{
Application.Quit();
}
public static void Main(string[] args)
{
Application.Init();
/* Create a new window */
Window window = new Window ("Pixmap'd Buttons!");
/* It's a good idea to do this for all windows */
window.DeleteEvent += new DeleteEventHandler(delete_event);
/* Sets the border width of the window */
window.BorderWidth = 10;
/* Create a new button */
Button button = new Button();
/* Connect the "clicked" signal of the button on your callback */
button.Clicked += new EventHandler(callback);
/* This calls our box creating function */
Widget box = xpm_label_box("info.xpm", "cool button");
/* Pack and show all our widgets */
box.Show();
button.Add(box);
button.Show();
window.Add(button);
window.ShowAll();
/* Rest in gtk_main and wait for the fun to begin! */
Application.Run();
}
}
}
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -r -o
buttons.exe
error CS2001: Source file 'buttons.exe' could not be opened
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o
buttons.exe
buttons.cs(8) error CS0246: The namespace `System.Drawing' can not be found
(missing assembly reference?)
Try using -r:System.Drawing
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono> mcs buttons.cs -r gtk-sharp.dll -r glib-sharp.dll -o
buttons.exe -r:System.Drawing
error CS0006: Cannot find assembly `System.Drawing'
Log:
Compilation failed: 1 error(s), 0 warnings
jbailo@linux:~/mono>
here's the source code:
//buttons.cs
namespace GtkSharpTutorial {
using Gtk;
using GtkSharp;
using System;
using System.Drawing;
public class buttons
{
/* Create a new hbox with an image and a label packed into it
* and return the box. */
static Widget xpm_label_box(string xpm_filename, string label_text )
{
/* create box for image and label */
HBox box = new HBox(false, 0);
box.BorderWidth = 2;
/* Now on to the image stuff */
Gtk.Image image = new Gtk.Image(xpm_filename);
/* Create a label for the button */
Label label = new Label (label_text);
/* Pack the image and label into the box */
box.PackStart( image, false, false, 3);
box.PackStart( label, false, false, 3);
image.Show();
label.Show();
return box;
}
/* Our usual callback function */
static void callback( object obj, EventArgs args)
{
Console.WriteLine("Hello again - cool button was pressed");
}
/* another callback */
static void delete_event(object obj, DeleteEventArgs args)
{
Application.Quit();
}
public static void Main(string[] args)
{
Application.Init();
/* Create a new window */
Window window = new Window ("Pixmap'd Buttons!");
/* It's a good idea to do this for all windows */
window.DeleteEvent += new DeleteEventHandler(delete_event);
/* Sets the border width of the window */
window.BorderWidth = 10;
/* Create a new button */
Button button = new Button();
/* Connect the "clicked" signal of the button on your callback */
button.Clicked += new EventHandler(callback);
/* This calls our box creating function */
Widget box = xpm_label_box("info.xpm", "cool button");
/* Pack and show all our widgets */
box.Show();
button.Add(box);
button.Show();
window.Add(button);
window.ShowAll();
/* Rest in gtk_main and wait for the fun to begin! */
Application.Run();
}
}
}