Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 09, 2013 Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
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? |
September 10, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anton Alexeev | 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 |
September 11, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | >> 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 :(
|
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anton Alexeev | 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
|
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to DLearner | 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 |
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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); |
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anton Alexeev | 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 |
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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?
|
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Is there no Browser module in DWT? |
September 12, 2013 Re: Compiling the hello world example fails (2) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anton Alexeev | 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? |
Copyright © 1999-2021 by the D Language Foundation