Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 11, 2015 Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
On Ubuntu Linux, I can draw a simple Hello World interface (and a button on it to close the window) with Glade and save the file. Now how do I use GtkD and D to load that interface? Anyone got a super simple tutorial for that? |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | On Friday, 11 September 2015 at 06:00:39 UTC, Mike McKee wrote: > On Ubuntu Linux, I can draw a simple Hello World interface (and a button on it to close the window) with Glade and save the file. Now how do I use GtkD and D to load that interface? Anyone got a super simple tutorial for that? I think the start of this probably looks like the following, but I'm not certain: import gtk; import gobject.Type; import std.stdio; import std.c.process; int main (string[] args) { Main.init(args); Builder b = new Builder(); b.addFromFile("test1.glade"); Window w = cast(Window)b.getObject("window1"); w.showAll(); Main.run(); return 0; } ...so, this assumed that I had a test1.glade file, and that I had this line inside it: <object class="GtkApplicationWindow" id="window1"> So now I need to figure out how to get GtkD installed on Ubuntu Linux 14.04. |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | On Friday, 11 September 2015 at 06:45:07 UTC, Mike McKee wrote: > On Friday, 11 September 2015 at 06:00:39 UTC, Mike McKee wrote: >> [...] > > I think the start of this probably looks like the following, but I'm not certain: > > import gtk; > import gobject.Type; > import std.stdio; > import std.c.process; > > int main (string[] args) > { > Main.init(args); > Builder b = new Builder(); > b.addFromFile("test1.glade"); > Window w = cast(Window)b.getObject("window1"); > w.showAll(); > Main.run(); > return 0; > } Hi Mike, There's a Glade example in the demos/builder directory... Regards, -<Mike>- > > ...so, this assumed that I had a test1.glade file, and that I had this line inside it: > > <object class="GtkApplicationWindow" id="window1"> > > So now I need to figure out how to get GtkD installed on Ubuntu Linux 14.04. |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike James | On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: > There's a Glade example in the demos/builder directory... I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps from here: http://d-apt.sourceforge.net/ $ sudo su # wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list # apt-get update && apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && apt-get update # apt-get install libgtkd3-dev libgtkd3-doc I then run the following and it fails: # dmd test1.d test1.d(1): Error: module gtk is in file 'gtk.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | On Friday, 11 September 2015 at 07:13:22 UTC, Mike McKee wrote: > On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: >> There's a Glade example in the demos/builder directory... > > I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps from here: > > http://d-apt.sourceforge.net/ > > $ sudo su > # wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list > # apt-get update && apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && apt-get update > # apt-get install libgtkd3-dev libgtkd3-doc > > I then run the following and it fails: > > # dmd test1.d > test1.d(1): Error: module gtk is in file 'gtk.d' which cannot be read > import path[0] = /usr/include/dmd/phobos > import path[1] = /usr/include/dmd/druntime/import It looks last keep you're missing an import path (-Ipath_to_source). Check out http://dlang.org/dmd-linux.html#switches Regards, -<Mike>- |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike James | On Friday, 11 September 2015 at 07:20:57 UTC, Mike James wrote: > It looks last keep you're missing an import path (-Ipath_to_source). Check out http://dlang.org/dmd-linux.html#switches I tried this just now: # dmd test1.d -I/usr/include/dmd/gtkd3/gtkc /usr/include/dmd/gtkd3/gtkc/gtk.d(28): Error: module gtktypes is in file 'gtkc/gtktypes.d' which cannot be read import path[0] = /usr/include/dmd/gtkd3/gtkc import path[1] = /usr/include/dmd/phobos import path[2] = /usr/include/dmd/druntime/import It's saying that it can't read gtkc/gtktypes.d, but there is a file in path /usr/include/dmd/gtkd3/gtkc/gtktypes.d |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | On Friday, 11 September 2015 at 07:29:23 UTC, Mike McKee wrote:
> On Friday, 11 September 2015 at 07:20:57 UTC, Mike James wrote:
>> It looks last keep you're missing an import path (-Ipath_to_source). Check out http://dlang.org/dmd-linux.html#switches
>
> I tried this just now:
>
> # dmd test1.d -I/usr/include/dmd/gtkd3/gtkc
> /usr/include/dmd/gtkd3/gtkc/gtk.d(28): Error: module gtktypes is in file 'gtkc/gtktypes.d' which cannot be read
> import path[0] = /usr/include/dmd/gtkd3/gtkc
> import path[1] = /usr/include/dmd/phobos
> import path[2] = /usr/include/dmd/druntime/import
>
> It's saying that it can't read gtkc/gtktypes.d, but there is a file in path /usr/include/dmd/gtkd3/gtkc/gtktypes.d
try # dmd test1.d -I/usr/include/dmd/gtkd3
I'm using GtkD on Windows so there is a .../src directory with all the source files in.
regards, -<mike>-
|
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike James | On Friday, 11 September 2015 at 07:39:46 UTC, Mike James wrote: > try # dmd test1.d -I/usr/include/dmd/gtkd3 # dmd test1.d -L-ldl -I/usr/include/dmd/gtkd3 test1.o:(.rodata+0x12c): undefined reference to `_D3gtk7Builder12__ModuleInfoZ' test1.o:(.rodata+0x130): undefined reference to `_D3gtk4Main12__ModuleInfoZ' test1.o:(.rodata+0x134): undefined reference to `_D3gtk6Window12__ModuleInfoZ' test1.o:(.rodata+0x138): undefined reference to `_D7gobject4Type12__ModuleInfoZ' test1.o: In function `_Dmain': test1.d:(.text._Dmain+0xc): undefined reference to `_D3gtk4Main4Main4initFKAAyaZv' test1.d:(.text._Dmain+0x11): undefined reference to `_D3gtk7Builder7Builder7__ClassZ' test1.d:(.text._Dmain+0x1c): undefined reference to `_D3gtk7Builder7Builder6__ctorMFZC3gtk7Builder7Builder' test1.d:(.text._Dmain+0x38): undefined reference to `_D3gtk6Window6Window7__ClassZ' test1.d:(.text._Dmain+0x63): undefined reference to `_D3gtk4Main4Main3runFZv' collect2: error: ld returned 1 exit status I also tried without the "-L-ldl" and got the same result. I then tried this: # rdmd -I/usr/include/dmd/gtkd3 -L-ldl test1.d ** (test1:3169): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-PJfKDfNeIv: Connection refused Segmentation fault (core dumped) |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | On Friday, 11 September 2015 at 07:47:15 UTC, Mike McKee wrote: > [...] The undefined references mean you haven't provided a linker path to the GtkD libs. Have you built the GtkD libraries? Check out https://github.com/gtkd-developers/GtkD |
September 11, 2015 Re: Hello World Example with Glade? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike McKee | El 11/09/15 a les 09:13, Mike McKee via Digitalmars-d-learn ha escrit: > On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: >> There's a Glade example in the demos/builder directory... > > I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps from here: > > http://d-apt.sourceforge.net/ > > $ sudo su > # wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list > # apt-get update && apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && apt-get update > # apt-get install libgtkd3-dev libgtkd3-doc > > I then run the following and it fails: > > # dmd test1.d > test1.d(1): Error: module gtk is in file 'gtk.d' which cannot be read > import path[0] = /usr/include/dmd/phobos > import path[1] = /usr/include/dmd/druntime/import > On <http://d-apt.sourceforge.net/> there is the "pkg-config" section: --- pkg-config: Every dev package contains "pkg-config" (shared and static) configuration files for the specific library. i.e. link GtkD2 applications against "libgtkd2.so" and "libphobos2.so" shared libraries: $ dmd `pkg-config --cflags --libs gtkd2` my_gtkd2_app.d or link GtkD2 applications against "libgtkd2.a" and "libphobos2.a" static libraries: $ dmd `pkg-config --cflags --libs gtkd2-static` my_gtkd2_app.d --- Best regards |
Copyright © 1999-2021 by the D Language Foundation