fail to compite *.exe

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

fail to compite *.exe

satimis
Hi folks,

Debian 5.0

I'm following GtkSharpBeginnersGuide to learn GTK#
http://www.mono-project.com/GtkSharpBeginnersGuide

Coming to:-
For example, to use the event Gdk.Event, we could use something like this:
........

The file created is :

$ cat helloword.cs
 using System;
 using Gtk;
 using Gdk;
 
 public class GtkHelloWorld {
 
   public static void Main() {
     Application.Init();
 
     //Create the Window
     Window myWin = new Window("My first GTK# Application! ");
     myWin.Resize(200,200);
     
     //Create a label and put some text in it.    
     Label myLabel = new Label();
     myLabel.Text = "Hello World!!!!";
         
     //Add the label to the form    
     myWin.Add(myLabel);
     
     //Show Everything    
     myWin.ShowAll();
     
     Application.Run();  
   }
 }
    ...
    widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);
    ...
    private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {
        // single click
        if (args.Event.Type == EventType.ButtonPress) {
            ...
        }
        // double click
        if (args.Event.Type == EventType.TwoButtonPress) {
            ...
        }
       
        // the left button was used
        if (args.Event.Button == 1) {
            ...
        }
    }

- end -


On compiling;

$ mcs -pkg:gtk-sharp-2.0 helloword.cs -debug
helloword.cs(27,5): error CS8025: Parsing error
Compilation failed: 1 error(s), 0 warnings

I have been googling the warning on Internet and found "it needs "cocoa-sharp-dev"

But I can't find this package on repo:-

$ apt-cache policy cocoa-sharp-dev
W: Unable to locate package cocoa-sharp-dev

$ apt-cache search cocoa-sharp-dev
No printout


Please help.  TIA


B.R.
Stephen


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: fail to compite *.exe

Robert Jordan
On 23.04.2010 13:24, Stephen Liu wrote:
> $ mcs -pkg:gtk-sharp-2.0 helloword.cs -debug
> helloword.cs(27,5): error CS8025: Parsing error

You want "gmcs".

> Compilation failed: 1 error(s), 0 warnings

Robert

_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: fail to compite *.exe

satimis
Hi Robert,

Thanks for your advice.

$ gmcs -pkg:gtk-sharp-2.0 helloword.cs -debug
helloword.cs(27,5): error CS8025: Parsing error
Compilation failed: 1 error(s), 0 warnings

Still the same

B.R.
satimis








----- Original Message ----
From: Robert Jordan <[hidden email]>
To: [hidden email]
Sent: Fri, April 23, 2010 4:58:23 AM
Subject: Re: [Mono-list] fail to compite *.exe

On 23.04.2010 13:24, Stephen Liu wrote:
> $ mcs -pkg:gtk-sharp-2.0 helloword.cs -debug
> helloword.cs(27,5): error CS8025: Parsing error

You want "gmcs".

> Compilation failed: 1 error(s), 0 warnings

Robert

_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: fail to compite *.exe

Alexander Shulgin-2
On 23.04.2010 16:02, Stephen Liu wrote:
> Hi Robert,
>
> Thanks for your advice.
>
> $ gmcs -pkg:gtk-sharp-2.0 helloword.cs -debug
> helloword.cs(27,5): error CS8025: Parsing error
> Compilation failed: 1 error(s), 0 warnings

You need to take a close look at line 27 in your helloword.cs
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: fail to compite *.exe

satimis
Hi Alexander,


Following the document
http://www.mono-project.com/GtkSharpBeginnersGuide
For example, to use the event Gdk.Event, we could use something like this:

I copied;

using Gdk;
    ...
    widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);
    ...
    private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {
        // single click
        if (args.Event.Type == EventType.ButtonPress) {
            ...
        }
        // double click
        if (args.Event.Type == EventType.TwoButtonPress) {
            ...
        }
       
        // the left button was used
        if (args.Event.Button == 1) {
            ...
        }
    }

- end -

to the bottom of helloworld.cs and edited the file.

Now the file looks

$ cat helloword.cs
 using System;
 using Gtk;
 using Gdk;
 
 public class GtkHelloWorld {
 
   public static void Main() {
     Application.Init();
 
     //Create the Window
     Window myWin = new Window("My first GTK# Application! ");
     myWin.Resize(200,200);
     
     //Create a label and put some text in it.    
     Label myLabel = new Label();
     myLabel.Text = "Hello World!!!!";
         
     //Add the label to the form    
     myWin.Add(myLabel);
     
     //Show Everything    
     myWin.ShowAll();
     
     Application.Run();  
   }
 }
    widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);

    private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {
        // single click
        if (args.Event.Type == EventType.ButtonPress) {
        }
        // double click
        if (args.Event.Type == EventType.TwoButtonPress) {
        }
        // the left button was used
        if (args.Event.Button == 1) {
        }
    }
- end -


The problem is on line 27,30);

widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);

I suppose "30" is the position, counting from left.

I have no idea how to change "+="

I tried "==" without result.


Please help.  TIA


B.R.
Stephen L



----- Original Message ----
From: Alexander Shulgin <[hidden email]>
To: [hidden email]
Sent: Fri, April 23, 2010 6:04:49 AM
Subject: Re: [Mono-list] fail to compite *.exe

On 23.04.2010 16:02, Stephen Liu wrote:
> Hi Robert,
>
> Thanks for your advice.
>
> $ gmcs -pkg:gtk-sharp-2.0 helloword.cs -debug
> helloword.cs(27,5): error CS8025: Parsing error
> Compilation failed: 1 error(s), 0 warnings

You need to take a close look at line 27 in your helloword.cs
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: fail to compite *.exe

Alexander Shulgin-2
On 23.04.2010 16:56, Stephen Liu wrote:
> Hi Alexander,
>
> The problem is on line 27,30);
>
> widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);

Yeah, the line itself is OK, but notice extra closing braces before
it--here's your problem:

 >       Application.Run();
 >     }
 >   }
 >      widget.ButtonPressEvent += new
ButtonPressEventHandler(ButtonPressHandler);

You doing this outside of your class methods (and the class itself).

--
Alex
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list