www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GtkD - how to install

reply "Amateur" <repakolius centrum.cz> writes:
Hello,

I'm beginning with programming on desktop. After choosing which
language is "da best" for me, I chose D. And now I want to create
GUI applications, so I tried installing GtkD and I failed. Can
anybody give me a short manual?

I'd like to code on linux (openSUSE 13.1), but if I'll get help
on Windows, I'll be happy too.

Thank you
Dec 22 2013
next sibling parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Sunday, 22 December 2013 at 13:29:04 UTC, Amateur wrote:
 Hello,

 I'm beginning with programming on desktop. After choosing which
 language is "da best" for me, I chose D. And now I want to 
 create
 GUI applications, so I tried installing GtkD and I failed. Can
 anybody give me a short manual?

 I'd like to code on linux (openSUSE 13.1), but if I'll get help
 on Windows, I'll be happy too.

 Thank you
I would recommend using dub. Either download a release from http://code.dlang.org/download or clone the github repo https://github.com/rejectedsoftware/dub and build with build.sh then you can list gtkd as a dependency for your project and dub will sort it out for you (hopefully). You will need to install the latest gtk+ libs first with yast or zipper or whatever you use for package management.
Dec 22 2013
parent reply "Amateur" <repakolius centrum.cz> writes:
On Sunday, 22 December 2013 at 13:38:25 UTC, John Colvin wrote:
 On Sunday, 22 December 2013 at 13:29:04 UTC, Amateur wrote:
 Hello,

 I'm beginning with programming on desktop. After choosing which
 language is "da best" for me, I chose D. And now I want to 
 create
 GUI applications, so I tried installing GtkD and I failed. Can
 anybody give me a short manual?

 I'd like to code on linux (openSUSE 13.1), but if I'll get help
 on Windows, I'll be happy too.

 Thank you
I would recommend using dub. Either download a release from http://code.dlang.org/download or clone the github repo https://github.com/rejectedsoftware/dub and build with build.sh then you can list gtkd as a dependency for your project and dub will sort it out for you (hopefully). You will need to install the latest gtk+ libs first with yast or zipper or whatever you use for package management.
Yeah, I installed dub and ran commands "dub init main" and "dub fetch --local gtk-d". It worked properly, but how to continue? I tried compile simple app which contains only "import gtk.MainWindow;" and compiler yells that source for this cannot be found. What have I to do next? I have installed Gtk+ libraries, dmd, dub and I ran too commands "dub init main" and "dub fetch --local gtk-d".
Dec 22 2013
next sibling parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 22.12.2013 15:15, schrieb Amateur:
 Yeah, I installed dub and ran commands "dub init main" and "dub fetch
 --local gtk-d". It worked properly, but how to continue? I tried compile
 simple app which contains only "import gtk.MainWindow;" and compiler
 yells that source for this cannot be found.

 What have I to do next?
 I have installed Gtk+ libraries, dmd, dub and I ran too commands "dub
 init main" and "dub fetch --local gtk-d".
You have to create a package.json file for you project and add gtk as a dependency. See this page for further details: http://code.dlang.org/package-format When you are done setting up the package.json call "dub init" and everything should be setup correctly.
Dec 22 2013
prev sibling parent reply Mike Parker <aldacron gmail.com> writes:
On 12/22/2013 11:15 PM, Amateur wrote:

 What have I to do next?
 I have installed Gtk+ libraries, dmd, dub and I ran too commands "dub
 init main" and "dub fetch --local gtk-d".
You need to add gtkd as a dependency to your project's package.json: { "dependencies": { "gtk-d": "~master" } } Also, when using dub to manage your project, you don't need to 'fetch'. As long as a library is listed as a dependency, dub will fetch it automatically.
Dec 22 2013
parent Mike Wey <mike-wey example.com> writes:
On 12/22/2013 03:41 PM, Mike Parker wrote:
 On 12/22/2013 11:15 PM, Amateur wrote:

 What have I to do next?
 I have installed Gtk+ libraries, dmd, dub and I ran too commands "dub
 init main" and "dub fetch --local gtk-d".
You need to add gtkd as a dependency to your project's package.json: { "dependencies": { "gtk-d": "~master" } } Also, when using dub to manage your project, you don't need to 'fetch'. As long as a library is listed as a dependency, dub will fetch it automatically.
I would recommend listing the subpackage as a dependency: { "dependencies": { "gtk-d:gtkd": "~master" } } -- Mike Wey
Dec 22 2013
prev sibling next sibling parent reply Russel Winder <russel winder.org.uk> writes:
On Sun, 2013-12-22 at 13:29 +0000, Amateur wrote:
 Hello,
=20
 I'm beginning with programming on desktop. After choosing which
 language is "da best" for me, I chose D. And now I want to create
 GUI applications, so I tried installing GtkD and I failed. Can
 anybody give me a short manual?
I cloned the Git repository for GtkD and then set up a bash script to give the GtkD make system all the right parameters so I could compile it for DMD, GDC and LDC2. However this is not trivial unless you are familiar with Make. However I also just tried using Dub and it works very nicely. I think the general opinion will these days be to use Dub.
 I'd like to code on linux (openSUSE 13.1), but if I'll get help
 on Windows, I'll be happy too.
I only have Debian and Fedora Linux and OS X, I don't do Windows ;-) --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Dec 22 2013
parent reply "DLang Beginner" <repakolius email.cz> writes:
On Sunday, 22 December 2013 at 14:52:23 UTC, Russel Winder wrote:
 On Sun, 2013-12-22 at 13:29 +0000, Amateur wrote:
 Hello,
 
 I'm beginning with programming on desktop. After choosing which
 language is "da best" for me, I chose D. And now I want to 
 create
 GUI applications, so I tried installing GtkD and I failed. Can
 anybody give me a short manual?
I cloned the Git repository for GtkD and then set up a bash script to give the GtkD make system all the right parameters so I could compile it for DMD, GDC and LDC2. However this is not trivial unless you are familiar with Make. However I also just tried using Dub and it works very nicely. I think the general opinion will these days be to use Dub.
 I'd like to code on linux (openSUSE 13.1), but if I'll get help
 on Windows, I'll be happy too.
I only have Debian and Fedora Linux and OS X, I don't do Windows ;-)
Hello again. I have successfully installed dub and made GtkD dependency. But... I tried to compile this code: import gtk.MainWindow; import gtk.Label; import gtk.Main; void main(string[] args) { Main.init(args); MainWindow win = new MainWindow("Hello World"); win.setDefaultSize(200, 100); win.add(new Label("Hello World")); win.showAll(); Main.run(); } But compiler said that he won't compile this, because "app.d(1): Error: module MainWindow is in file 'gtk/MainWindow.d' which cannot be read". Etc. for other imports. So I copied libraries in /source directory and now compiler knows, from where can he import, but compiler is yelling another errors. app.o:(.data+0x10): undefined reference to `_D3gtk10MainWindow12__ModuleInfoZ' app.o:(.data+0x18): undefined reference to `_D3gtk5Label12__ModuleInfoZ' app.o:(.data+0x20): undefined reference to `_D3gtk4Main12__ModuleInfoZ' app.o: In function `_Dmain': app.d:(.text._Dmain+0x15): undefined reference to `_D3gtk4Main4Main4initFKAAyaZv' app.d:(.text._Dmain+0x1b): undefined reference to `_D3gtk10MainWindow10MainWindow7__ClassZ' app.d:(.text._Dmain+0x3a): undefined reference to `_D3gtk10MainWindow10MainWindow6__ctorMFAyaZC3gtk10MainWindow10MainWindow' app.d:(.text._Dmain+0x5b): undefined reference to `_D3gtk5Label5Label7__ClassZ' app.d:(.text._Dmain+0x85): undefined reference to `_D3gtk5Label5Label6__ctorMFAyabZC3gtk5Label5Label' app.d:(.text._Dmain+0xa9): undefined reference to `_D3gtk4Main4Main3runFZv' collect2: error: ld returned 1 exit status --- errorlevel 1
Dec 23 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
Show your package.json file and the project structure.
Dec 23 2013
parent reply "DLang Beginner" <repakolius email.cz> writes:
On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr Druzhinin 
wrote:
 Show your package.json file and the project structure.
https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png https://www.dropbox.com/s/9vs4r9l3lvdw2y1/dlang-gtk2.png
Dec 23 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
23.12.2013 19:19, DLang Beginner пишет:
 On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr Druzhinin wrote:
 Show your package.json file and the project structure.
https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png https://www.dropbox.com/s/9vs4r9l3lvdw2y1/dlang-gtk2.png
You shouldn't create your app inside gtkd structure. Try the following: cd mkdir test cd test dub init copy ~/Desktop/gtkd/source/app.d ./source/ copy ~/Desktop/gtkd/package.json . dub and show what will happen
Dec 23 2013
parent reply "DLang Beginner" <repakolius email.cz> writes:
On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr Druzhinin 
wrote:
 23.12.2013 19:19, DLang Beginner пишет:
 On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr 
 Druzhinin wrote:
 Show your package.json file and the project structure.
https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png https://www.dropbox.com/s/9vs4r9l3lvdw2y1/dlang-gtk2.png
You shouldn't create your app inside gtkd structure. Try the following: cd mkdir test cd test dub init copy ~/Desktop/gtkd/source/app.d ./source/ copy ~/Desktop/gtkd/package.json . dub and show what will happen
Yeah, that worked! Application successfully compiled. But when I try start it, I'm getting another error because I don't have libgdkglext-3.0 library. object.Exception ../../.dub/packages/gtk-d-master/src/gtkc/Loader.d(127): Library load failed: libgdkglext-3.0.so.0
Dec 23 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
23.12.2013 22:52, DLang Beginner пишет:
 On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr Druzhinin wrote:
 You shouldn't create your app inside gtkd structure. Try the following:
 cd
 mkdir test
 cd test
 dub init
 copy ~/Desktop/gtkd/source/app.d ./source/
 copy ~/Desktop/gtkd/package.json .
 dub

 and show what will happen
Yeah, that worked! Application successfully compiled. But when I try start it, I'm getting another error because I don't have libgdkglext-3.0 library. object.Exception ../../.dub/packages/gtk-d-master/src/gtkc/Loader.d(127): Library load failed: libgdkglext-3.0.so.0
Either build this libraries like me or try to change dependency in package.json: "gtk-d": "~master" => "gtk-d:gtkd": "~master" You get error because your app try to use opengl extention for gtk, but this extension isn't provided by default for gtk3. I solved this problem for me, but I spent much time and frankly can't remember my steps. But if you don't need opengl you can use only subpackage of gtkd as I write above.
Dec 23 2013
parent reply "DLang Beginner" <repakolius email.cz> writes:
On Monday, 23 December 2013 at 16:20:24 UTC, Alexandr Druzhinin 
wrote:
 23.12.2013 22:52, DLang Beginner пишет:
 On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr 
 Druzhinin wrote:
 You shouldn't create your app inside gtkd structure. Try the 
 following:
 cd
 mkdir test
 cd test
 dub init
 copy ~/Desktop/gtkd/source/app.d ./source/
 copy ~/Desktop/gtkd/package.json .
 dub

 and show what will happen
Yeah, that worked! Application successfully compiled. But when I try start it, I'm getting another error because I don't have libgdkglext-3.0 library. object.Exception ../../.dub/packages/gtk-d-master/src/gtkc/Loader.d(127): Library load failed: libgdkglext-3.0.so.0
Either build this libraries like me or try to change dependency in package.json: "gtk-d": "~master" => "gtk-d:gtkd": "~master" You get error because your app try to use opengl extention for gtk, but this extension isn't provided by default for gtk3. I solved this problem for me, but I spent much time and frankly can't remember my steps. But if you don't need opengl you can use only subpackage of gtkd as I write above.
OH YES! No, I don't need OpenGL, so I changed dependency and it works fine! Thank you so much! I <3 D and it's community. :)
Dec 23 2013
parent Alexandr Druzhinin <drug2004 bk.ru> writes:
23.12.2013 23:50, DLang Beginner пишет:
 On Monday, 23 December 2013 at 16:20:24 UTC, Alexandr Druzhinin wrote:
 23.12.2013 22:52, DLang Beginner пишет:
 Either build this libraries like me or try to change dependency in
 package.json:
     "gtk-d": "~master" => "gtk-d:gtkd": "~master"
 You get error because your app try to use opengl extention for gtk,
 but this extension isn't provided by default for gtk3. I solved this
 problem for me, but I spent much time and frankly can't remember my
 steps. But if you don't need opengl you can use only subpackage of
 gtkd as I write above.
OH YES! No, I don't need OpenGL, so I changed dependency and it works fine! Thank you so much! I <3 D and it's community. :)
You're welcome!
Dec 23 2013
prev sibling parent Jordi Sayol <g.sayol yahoo.es> writes:
El 22/12/13 14:29, Amateur ha escrit:
 Hello,
 
 I'm beginning with programming on desktop. After choosing which
 language is "da best" for me, I chose D. And now I want to create
 GUI applications, so I tried installing GtkD and I failed. Can
 anybody give me a short manual?
 
 I'd like to code on linux (openSUSE 13.1), but if I'll get help
 on Windows, I'll be happy too.
 
 Thank you
 
There is <http://d-apt.sourceforge.net/> for Debian Linux. -- Jordi Sayol
Dec 22 2013