www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Compiling the hello world example fails (2)

reply "Anton Alexeev" <alexanto gmx.de> writes:
Ubuntu 13.04, x86

I've followed this instruction: 
https://github.com/d-widget-toolkit/dwt

Everything was ok, no errors.

Then I've tried to compile hello world:

$ dmd test.d -I/home/virtualbox/dwt/imp 
-J/home/virtualbox/dwt/org.eclipse.swt.gtk.linux.x86/res 
-L-L/home/virtualbox/dwt/lib -L-lorg.eclipse.swt.gtk.linux.x86 
-L-ldwt-base

/usr/bin/ld: cannot find -lorg.eclipse.swt.gtk.linux.x86
/usr/bin/ld: cannot find -ldwt-base
collect2: ошибка: выполнение ld завершилось с
кодом возврата 1
--- errorlevel 1

With -L--verbose flag:
http://pastebin.com/9tavXU96

There you can see that the linker tries to find 
liborg.eclipse.swt.gtk.linux.x86.a and not just 
org.eclipse.swt.gtk.linux.x86, so I've added "lib" to the file 
names and got this:
http://pastebin.com/dVzzXqS6

Any help?
Sep 09 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-09-09 20:15, Anton Alexeev wrote:
 Ubuntu 13.04, x86

 I've followed this instruction: https://github.com/d-widget-toolkit/dwt

 Everything was ok, no errors.

 Then I've tried to compile hello world:

 $ dmd test.d -I/home/virtualbox/dwt/imp
 -J/home/virtualbox/dwt/org.eclipse.swt.gtk.linux.x86/res
 -L-L/home/virtualbox/dwt/lib -L-lorg.eclipse.swt.gtk.linux.x86 -L-ldwt-base

 /usr/bin/ld: cannot find -lorg.eclipse.swt.gtk.linux.x86
 /usr/bin/ld: cannot find -ldwt-base
 collect2: ошибка: выполнение ld завершилось с
кодом возврата 1
 --- errorlevel 1

 With -L--verbose flag:
 http://pastebin.com/9tavXU96

 There you can see that the linker tries to find
 liborg.eclipse.swt.gtk.linux.x86.a and not just
 org.eclipse.swt.gtk.linux.x86, so I've added "lib" to the file names
Ok, to avoid that you can I think you add a colon before the library name when linking: -L-l:<lib> Where <lib> is the library linking. The build script should be changed to append prepend "lib" to the library names.
 and got this:
 http://pastebin.com/dVzzXqS6

 Any help?
Crap, it seems you need to manually link with the system libraries. They're located in this array: https://github.com/d-widget-toolkit/dwt/blob/master/build.d#L101 Hope that solves it. Sorry for the inconvenience. -- /Jacob Carlborg
Sep 09 2013
parent reply "Anton Alexeev" <alexanto gmx.de> writes:
 and got this:
 http://pastebin.com/dVzzXqS6

 Any help?
Crap, it seems you need to manually link with the system libraries. They're located in this array: https://github.com/d-widget-toolkit/dwt/blob/master/build.d#L101 Hope that solves it. Sorry for the inconvenience.
Manually linking worked for me, thanks! One more question: where can I find documentation and some examples how to work with DWT? I don't even have an idea how to load an image as an icon. There is "Shell.setImage(Image image)" method but how can I create an Image-object? _____ I wanted to run away from Java, but it still haunts me :(
Sep 11 2013
parent reply "DLearner" <dlearner gmail.com> writes:
On Wednesday, 11 September 2013 at 21:16:55 UTC, Anton Alexeev
wrote:
 and got this:
 http://pastebin.com/dVzzXqS6

 Any help?
Crap, it seems you need to manually link with the system libraries. They're located in this array: https://github.com/d-widget-toolkit/dwt/blob/master/build.d#L101 Hope that solves it. Sorry for the inconvenience.
Manually linking worked for me, thanks! One more question: where can I find documentation and some examples how to work with DWT? I don't even have an idea how to load an image as an icon. There is "Shell.setImage(Image image)" method but how can I create an Image-object? _____ I wanted to run away from Java, but it still haunts me :(
DWT and SWT follow the same API, so just google SWT for documentation
Sep 11 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-09-12 03:57, DLearner wrote:

 DWT and SWT follow the same API, so just google SWT for
 documentation
The official API reference for SWT is here: http://www.eclipse.org/swt/javadoc.php There's a bunch of snippets here: http://www.eclipse.org/swt/snippets/ Some of which are already ported to D: https://github.com/d-widget-toolkit/org.eclipse.swt.snippets You should already have these if you're cloned the DWT repository correctly. If you need any D related help, like threads, IO, delegates or similar please continue asking here. There are a couple of differences/extension in DWT. http://dsource.org/projects/dwt/wiki/DiffToOriginal "Package and Module renames" isn't true anymore. I guess I should add this list to Github. -- /Jacob Carlborg
Sep 11 2013
parent reply "Anton Alexeev" <alexanto gmx.de> writes:
OK, thanks for the links!

First noob question:

I need an icon for the window. The Shell class has a method 
setImage(Image image). In Java there is a SWTResourceManager 
available:

shell.setImage(SWTResourceManager.getImage("/home/virtualbox/favicon.png"));

I've looked around a bit in *.di files and found an Image and an 
ImageLoader classes. Maybe it could work but I don't know how to 
create a Java String...

ImageLoader imageLoader = new ImageLoader();
Image image = new Image();
image.init_(imageLoader.load("/home/virtualbox/favicon.png"));
shell.setImage(image);
Sep 12 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-09-12 12:31, Anton Alexeev wrote:
 OK, thanks for the links!

 First noob question:

 I need an icon for the window. The Shell class has a method
 setImage(Image image). In Java there is a SWTResourceManager available:

 shell.setImage(SWTResourceManager.getImage("/home/virtualbox/favicon.png"));


 I've looked around a bit in *.di files and found an Image and an
 ImageLoader classes. Maybe it could work but I don't know how to create
 a Java String...

 ImageLoader imageLoader = new ImageLoader();
 Image image = new Image();
 image.init_(imageLoader.load("/home/virtualbox/favicon.png"));
 shell.setImage(image);
SWTResourceManager is not part of the standard SWT. It's seems to be a part of WindowBuilder. Here's an example of how to set the icon of a window: http://www.java2s.com/Tutorial/Java/0280__SWT/Setleftuppercornerimage.htm That site contains many other SWT tutorials as well. -- /Jacob Carlborg
Sep 12 2013
next sibling parent reply "Anton Alexeev" <alexanto gmx.de> writes:
On Thursday, 12 September 2013 at 11:23:51 UTC, Jacob Carlborg 
wrote:
 On 2013-09-12 12:31, Anton Alexeev wrote:
 OK, thanks for the links!

 First noob question:

 I need an icon for the window. The Shell class has a method
 setImage(Image image). In Java there is a SWTResourceManager 
 available:

 shell.setImage(SWTResourceManager.getImage("/home/virtualbox/favicon.png"));


 I've looked around a bit in *.di files and found an Image and 
 an
 ImageLoader classes. Maybe it could work but I don't know how 
 to create
 a Java String...

 ImageLoader imageLoader = new ImageLoader();
 Image image = new Image();
 image.init_(imageLoader.load("/home/virtualbox/favicon.png"));
 shell.setImage(image);
SWTResourceManager is not part of the standard SWT. It's seems to be a part of WindowBuilder. Here's an example of how to set the icon of a window: http://www.java2s.com/Tutorial/Java/0280__SWT/Setleftuppercornerimage.htm That site contains many other SWT tutorials as well.
Thanks a lot! One more question: how do I work with events?
Sep 12 2013
parent reply "Anton Alexeev" <alexanto gmx.de> writes:
Found out how to handle events:

class DisposeListenerImpl:DisposeListener{
    public void widgetDisposed(DisposeEvent e) {
        writeln("Disposed");
    }
}	

shell.addDisposeListener(new DisposeListenerImpl);


Is this the right way?
Sep 12 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-09-12 19:28, Anton Alexeev wrote:
 Found out how to handle events:

 class DisposeListenerImpl:DisposeListener{
     public void widgetDisposed(DisposeEvent e) {
         writeln("Disposed");
     }
 }

 shell.addDisposeListener(new DisposeListenerImpl);


 Is this the right way?
Yes, that's the standard SWT/Java way. You should be able to use a delegate as well. See: https://github.com/d-widget-toolkit/org.eclipse.swt.gtk.linux.x86/blob/master/src/org/eclipse/swt/widgets/Listener.d#L103 The same exist for Runnable as well: http://www.dsource.org/projects/dwt/wiki/DiffToOriginal#ThingsaddedorchangedinDWT: -- /Jacob Carlborg
Sep 12 2013
prev sibling parent reply "Anton Alexeev" <alexanto gmx.de> writes:
Is there no Browser module in DWT?
Sep 12 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-09-12 18:56, Anton Alexeev wrote:
 Is there no Browser module in DWT?
No, unfortunately the browser package never got ported properly. I think it was ported at some time, but only for Linux. It also depends on an additional external library. I can always try at compile and see what happens. -- /Jacob Carlborg
Sep 12 2013
parent reply "Anton Alexeev" <alexanto gmx.de> writes:
On Friday, 13 September 2013 at 06:27:05 UTC, Jacob Carlborg 
wrote:
 On 2013-09-12 18:56, Anton Alexeev wrote:
 Is there no Browser module in DWT?
No, unfortunately the browser package never got ported properly. I think it was ported at some time, but only for Linux. It also depends on an additional external library. I can always try at compile and see what happens.
So if there is no Browser module, how can I display some HTML in my app?
Sep 13 2013
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-09-13 21:50, Anton Alexeev wrote:

 So if there is no Browser module, how can I display some HTML in my app?
I don't know. You can always try and finish the port if you really need to display HTML. -- /Jacob Carlborg
Sep 14 2013
parent "Anton Alexeev" <alexanto gmx.de> writes:
On Saturday, 14 September 2013 at 10:45:42 UTC, Jacob Carlborg 
wrote:
 On 2013-09-13 21:50, Anton Alexeev wrote:

 So if there is no Browser module, how can I display some HTML 
 in my app?
I don't know. You can always try and finish the port if you really need to display HTML.
I think it's to hard for me now
Sep 15 2013
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2013-09-13 21:50, Anton Alexeev wrote:

 So if there is no Browser module, how can I display some HTML in my app?
You could use whatever API Gtk provides to render HTML. What you would use if you weren't using DWT. -- /Jacob Carlborg
Sep 14 2013