www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GtkD HelloWorld app crashes with exception

reply "Enjoys Math" <enjoysmath gmail.com> writes:
I'm on Windows 7 64-bit and using DMD2, compiling a regular 
32-bit windows app using Visual D "New Project > Windows App" and 
replacing winmain.d with the code below:

<code>
module winmain;

private import gtk.MainWindow;
private import gtk.Label;
private import gtk.Main;

class HelloWorld : MainWindow
{
	this()
	{
		super("GtkD");
		setBorderWidth(10);
		add(new Label("Hello World"));

		showAll();
	}

}

void main(string[] args)


	Main.init(args);
	new HelloWorld();
	Main.run();

}
</code>

I'm using GtkD-2.2.0 from here:
https://code.google.com/p/gtkd-packages/downloads/list

and also the 32-bit runtime from there.

The output when I click "Start Debugging" in Visual D is to 
display a stdout window with some text (that I can't read since 
it's too fast.  I've tried setting breakpoints to no avail), no 
window is ever displayed.  Then in Visual D the output log shows:

<code>
First-chance exception at 0x76c6c41f in WindowsApp1.exe: 
0xE0440001: 0xe0440001.
The program '[3848] WindowsApp1.exe: Native' has exited with code 
1 (0x1).
</code>

Thank you for any suggestions.
May 17 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
18.05.2013 9:52, Enjoys Math пишет:
 I'm on Windows 7 64-bit and using DMD2, compiling a regular 32-bit
 windows app using Visual D "New Project > Windows App" and replacing
 winmain.d with the code below:

 ...

 I'm using GtkD-2.2.0 from here:
 https://code.google.com/p/gtkd-packages/downloads/list

 and also the 32-bit runtime from there.

 The output when I click "Start Debugging" in Visual D is to display a
 stdout window with some text (that I can't read since it's too fast.
 I've tried setting breakpoints to no avail), no window is ever
 displayed.  Then in Visual D the output log shows:

 <code>
 First-chance exception at 0x76c6c41f in WindowsApp1.exe: 0xE0440001:
 0xe0440001.
 The program '[3848] WindowsApp1.exe: Native' has exited with code 1 (0x1).
 </code>

 Thank you for any suggestions.
Works fine on my box. You have problem with gtk installation. But I can't specify what's the reason - I downloaded previous binaries. Also I recommend you to experiment with paths - check it out.
May 17 2013
next sibling parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 05:26:45 UTC, Alexandr Druzhinin 
wrote:
 18.05.2013 9:52, Enjoys Math пишет:
 I'm on Windows 7 64-bit and using DMD2, compiling a regular 
 32-bit
 windows app using Visual D "New Project > Windows App" and 
 replacing
 winmain.d with the code below:

 ...

 I'm using GtkD-2.2.0 from here:
 https://code.google.com/p/gtkd-packages/downloads/list

 and also the 32-bit runtime from there.

 The output when I click "Start Debugging" in Visual D is to 
 display a
 stdout window with some text (that I can't read since it's too 
 fast.
 I've tried setting breakpoints to no avail), no window is ever
 displayed.  Then in Visual D the output log shows:

 <code>
 First-chance exception at 0x76c6c41f in WindowsApp1.exe: 
 0xE0440001:
 0xe0440001.
 The program '[3848] WindowsApp1.exe: Native' has exited with 
 code 1 (0x1).
 </code>

 Thank you for any suggestions.
Works fine on my box. You have problem with gtk installation. But I can't specify what's the reason - I downloaded previous binaries. Also I recommend you to experiment with paths - check it out.
I installed 2.24 from here: https://code.google.com/p/gtkd-packages/downloads/list And the windows 7 path is set correctly to the Gtk-Runtime\bin folder. But the same problem persists.
May 17 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/18/2013 08:57 AM, Enjoys Math wrote:
 On Saturday, 18 May 2013 at 05:26:45 UTC, Alexandr Druzhinin wrote:
 18.05.2013 9:52, Enjoys Math пишет:
 I'm on Windows 7 64-bit and using DMD2, compiling a regular 32-bit
 windows app using Visual D "New Project > Windows App" and replacing
 winmain.d with the code below:

 ...

 I'm using GtkD-2.2.0 from here:
 https://code.google.com/p/gtkd-packages/downloads/list

 and also the 32-bit runtime from there.

 The output when I click "Start Debugging" in Visual D is to display a
 stdout window with some text (that I can't read since it's too fast.
 I've tried setting breakpoints to no avail), no window is ever
 displayed.  Then in Visual D the output log shows:

 <code>
 First-chance exception at 0x76c6c41f in WindowsApp1.exe: 0xE0440001:
 0xe0440001.
 The program '[3848] WindowsApp1.exe: Native' has exited with code 1
 (0x1).
 </code>

 Thank you for any suggestions.
Works fine on my box. You have problem with gtk installation. But I can't specify what's the reason - I downloaded previous binaries. Also I recommend you to experiment with paths - check it out.
I installed 2.24 from here: https://code.google.com/p/gtkd-packages/downloads/list And the windows 7 path is set correctly to the Gtk-Runtime\bin folder. But the same problem persists.
GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: https://code.google.com/p/gtkd-packages/downloads/list I will check out why it doesn't print the error message about not being able to find the Gtk3 dll. -- Mike Wey
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 10:47:13 UTC, Mike Wey wrote:
 GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: 
 https://code.google.com/p/gtkd-packages/downloads/list

 I will check out why it doesn't print the error message about 
 not being able to find the Gtk3 dll.
I get the same errors except for the zlib ones when all Gtk-runtimes are uninstalled, so it seems like you're right that the runtime is not being found. Okay, I've installed that 3.8 runtime, set both the user and system path vars at the beginnings and ends to have the runtime/bin dir. Restarted Vis D. Still have unhandled exceptions at run time.
May 18 2013
next sibling parent "Enjoys Math" <enjoysmath gmail.com> writes:
Should I try removing everything gtk-using and related from my
system?
May 18 2013
prev sibling parent reply "Mike Wey" <mike-wey example.com> writes:
On Saturday, 18 May 2013 at 18:54:50 UTC, Enjoys Math wrote:
 On Saturday, 18 May 2013 at 10:47:13 UTC, Mike Wey wrote:
 GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: 
 https://code.google.com/p/gtkd-packages/downloads/list

 I will check out why it doesn't print the error message about 
 not being able to find the Gtk3 dll.
I get the same errors except for the zlib ones when all Gtk-runtimes are uninstalled, so it seems like you're right that the runtime is not being found. Okay, I've installed that 3.8 runtime, set both the user and system path vars at the beginnings and ends to have the runtime/bin dir. Restarted Vis D. Still have unhandled exceptions at run time.
Try putting the path to the Gtk3 runtime at the start of the path, and then restart the machine and try again. -- Mike Wey
May 18 2013
parent "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 20:45:41 UTC, Mike Wey wrote:
 Try putting the path to the Gtk3 runtime at the start of the 
 path, and then restart the machine and try again.

 --
 Mike Wey
Okay, works now! The last problem I had was with the path. Solution: place your runtime/bin dir (e.g. C:\Program Files (x86)\Gtk-Runtime\bin) at the beginning of the *System* path and not the *User* path variable. Thanks all for the help, yo.
May 18 2013
prev sibling parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
Now the minimal example causing the error is a console app with 
code:


module main;
import std.stdio;

void main(string[] args)
{
	readln();
}


When I link with GtkD.lib, the executable is broken.

I've tried using GtkD 1.7.2 from that same google code repo, but 
got errors trying to build it.

Thanks.
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
I re-installed DMD 2.062 and now it's a compiler error:

------ Build started: Project: ConsoleApp3, Configuration: Debug 
Win32 ------
Building Debug\ConsoleApp3.exe...
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined _D3std3utf10decodeImplFNaNePxakKkZw 
(pure  trusted dchar std.utf.decodeImpl(const(char)*, uint, ref 
uint))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined 
_D6object9Exception6__ctorMFAyaAyakC6object9ThrowableZC9Exception 
(Exception object.Exception.__ctor(immutable(char)[], 
immutable(char)[], uint, object.Throwable))
Building Debug\ConsoleApp3.exe failed!
Details saved as 
"file://C:\home\Dropbox\Dev\AudioSynth\Tests\ConsoleApp3\ConsoleApp3\Debug\ConsoleApp3.buildlog.html"
May 18 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
18.05.2013 14:53, Enjoys Math пишет:
 I re-installed DMD 2.062 and now it's a compiler error:

 ------ Build started: Project: ConsoleApp3, Configuration: Debug Win32
 ------
 Building Debug\ConsoleApp3.exe...
 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
   Error 42: Symbol Undefined _D3std3utf10decodeImplFNaNePxakKkZw (pure
  trusted dchar std.utf.decodeImpl(const(char)*, uint, ref uint))
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
   Error 42: Symbol Undefined
 _D6object9Exception6__ctorMFAyaAyakC6object9ThrowableZC9Exception
 (Exception object.Exception.__ctor(immutable(char)[], immutable(char)[],
 uint, object.Throwable))
 Building Debug\ConsoleApp3.exe failed!
 Details saved as
 "file://C:\home\Dropbox\Dev\AudioSynth\Tests\ConsoleApp3\ConsoleApp3\Debug\ConsoleApp3.buildlog.html"
Try to rebuild GtkD if you re-installed dmd. Check if Gtk path is the first in path because can be other application with different version of Gtk
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 07:59:49 UTC, Alexandr Druzhinin 
wrote:

 Try to rebuild GtkD if you re-installed dmd. Check if Gtk path 
 is the first in path because can be other application with 
 different version of Gtk
Okay, I did both of those and got new errors: :\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core6memory2GC6qallocFkkZS4core6memory8BlkInfo_ (core.memory.BlkInfo_ core.memory.GC.qalloc(uint, uint)) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk (uint core.memory.GC.extend(void*, uint, uint)) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi (pure nothrow int core.bitop.bsr(uint)) Building Debug\ConsoleApp3.exe failed!
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
I'm guessing I should try building a Win32 app and maybe those 
symbols will then be defined.
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 08:25:34 UTC, Enjoys Math wrote:
 I'm guessing I should try building a Win32 app and maybe those 
 symbols will then be defined.
Here's a minimal Win32 app in visual D: module winmain; private import gtk.MainWindow; private import gtk.Label; private import gtk.Main; class HelloWorld : MainWindow { this() { super("GtkD"); setBorderWidth(10); add(new Label("Hello World")); showAll(); } } void main(string[] args) { Main.init(args); new HelloWorld(); Main.run(); } And the errors are: OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG) Error 42: Symbol Undefined _D4core6memory2GC7addRootFxPvZv (void core.memory.GC.addRoot(const(void*))) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG) Error 42: Symbol Undefined _D4core6memory2GC10removeRootFxPvZv (void core.memory.GC.removeRoot(const(void*))) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core6memory2GC6qallocFkkZS4core6memory8BlkInfo_ (core.memory.BlkInfo_ core.memory.GC.qalloc(uint, uint)) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk (uint core.memory.GC.extend(void*, uint, uint)) C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib) Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi (pure nothrow int core.bitop.bsr(uint)) Building Debug\WindowsApp2.exe failed!
May 18 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
18.05.2013 15:34, Enjoys Math пишет:
 And the errors are:

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG)
   Error 42: Symbol Undefined _D4core6memory2GC7addRootFxPvZv (void
 core.memory.GC.addRoot(const(void*)))
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG)
   Error 42: Symbol Undefined _D4core6memory2GC10removeRootFxPvZv (void
 core.memory.GC.removeRoot(const(void*)))
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
   Error 42: Symbol Undefined
 _D4core6memory2GC6qallocFkkZS4core6memory8BlkInfo_ (core.memory.BlkInfo_
 core.memory.GC.qalloc(uint, uint))
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
   Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk (uint
 core.memory.GC.extend(void*, uint, uint))
 C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
   Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi (pure nothrow int
 core.bitop.bsr(uint))
 Building Debug\WindowsApp2.exe failed!
Your compiler is installed incorrectly and can not find phobos of appropriate version. Check it once again. In your case this error should appear with any other example. Check it too, if you want.
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
On Saturday, 18 May 2013 at 08:46:40 UTC, Alexandr Druzhinin 
wrote:

 Your compiler is installed incorrectly and can not find phobos  
 of appropriate version. Check it once again. In your case this 
 error should appear with any other example. Check it too, if 
 you want.
Okay, I've re-installed DMD, rebuilt GtkD, and installed GtkD. Now a Win32 app compiles but I get a sequence of error boxes that pop up before the program gets to main(): Unhandled exception at 0x75e3c41f in WindowsApp2.exe 0xE440001: 0xe0440001 (I hit continue) Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 0xe0440001. (I hit continue) Title: Entry Point Not Found The procedure entry point deflateSetHeader could not be located in the dynamic link library zlib1.dll. (I hit OK) Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 0xe0440001. (I hit continue) Title: Entry Point Not Found The procedure entry point deflateSetHeader could not be located in the dynamic link library zlib1.dll. (I hit OK) Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 0xe0440001. (I hit continue) Then main() is entered.
May 18 2013
parent reply "Enjoys Math" <enjoysmath gmail.com> writes:
Then upon continuing I get an infinitely repeating

Unhandled exception at 0x00000000 in WindowsApp2.exe: 0xC0000005:
Access violation reading location 0x00000000.

message box popping up.
May 18 2013
parent Alexandr Druzhinin <drug2004 bk.ru> writes:
18.05.2013 16:17, Enjoys Math пишет:
 Then upon continuing I get an infinitely repeating

 Unhandled exception at 0x00000000 in WindowsApp2.exe: 0xC0000005:
 Access violation reading location 0x00000000.

 message box popping up.
Did you check that path to Gtk runtime binaries is the first? I guess there is some other application in your path variable that is using different zlib1.dll and when you run your app it load incorrect version that results in what you get. Check you path once again.
May 18 2013