mono doesn't find System.Drawing

  • Thread starter James Coburn's Grey Helmet Hair
  • Start date
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();
}
}
}
 
J

Jeff Relf

Hi Bailo, a.k.a. James Coburn's Grey Helmet Hair,
Re: Your:
error CS2001: Source file 'buttons.exe' could not be opened

What errors come up when you do a:
mcs buttons.cs -o buttons.exe ?

Look up the documentation for the stuff that pops up
it should tell you what .LIB files you need to link with
as well as what include files you'll need.

You might have to provide the path to the .LIB file too.
 
J

James Coburn's Grey Helmet Hair

Jeff said:
Hi Bailo, a.k.a. James Coburn's Grey Helmet Hair,
Re: Your:
error CS2001: Source file 'buttons.exe' could not be opened

What errors come up when you do a:
mcs buttons.cs -o buttons.exe ?

Look up the documentation for the stuff that pops up
it should tell you what .LIB files you need to link with
as well as what include files you'll need.

You might have to provide the path to the .LIB file too.

Ignore that first one. It was malformed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top