By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,276 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,276 IT Pros & Developers. It's quick & easy.

mono doesn't find System.Drawing

P: n/a

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();
}
}
}

--
W '04 <:> Open
Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.
Nov 22 '05 #2

P: n/a
Jeff Relf wrote:
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.

--
W '04 <:> Open
Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.