Jump to page: 1 2
Thread overview
GTKD - Application crashes - or not? [Coedit]
Jun 15, 2016
TheDGuy
Jun 15, 2016
Rene Zwanenburg
Jun 15, 2016
TheDGuy
Jun 15, 2016
Rene Zwanenburg
Jun 15, 2016
TheDGuy
Jun 15, 2016
Basile B.
Jun 16, 2016
Basile B.
Jun 16, 2016
TheDGuy
Jun 16, 2016
TheDGuy
Jun 16, 2016
Basile B.
Jun 16, 2016
TheDGuy
Jun 16, 2016
Basile B.
Jun 16, 2016
TheDGuy
Jun 16, 2016
Basile B.
Jun 16, 2016
TheDGuy
Jun 16, 2016
Basile B.
Jun 16, 2016
TheDGuy
Jun 17, 2016
Basile B.
Jun 17, 2016
TheDGuy
June 15, 2016
Hi,
this is my app:

import gtk.Main;
import gtk.MainWindow;
import gtk.CssProvider;
import gdk.Display;
import gdk.Screen;
import gtk.StyleContext;
import glib.GException;

class Window : MainWindow{
    this(int width, int height, string title){
        super(title);
        setDefaultSize(width, height);

        string cssPath = "test.css";

        CssProvider provider = new CssProvider();
        provider.loadFromPath(cssPath);

        Display display = Display.getDefault();
        Screen screen = display.getDefaultScreen();
        StyleContext.addProviderForScreen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

        showAll();
    }
}

void main(string[] args){
    Main.init(args);
    auto win = new Window(250,250,"Tutorial");
    Main.run();
}

I use Coedit to write and execute D apps. If i execute this app i get the error message (it compiles fine):

glib.GException.GException@..\..\..\AppData\Roaming\dub\packages\gtk-d-3.3.1\gtk-d\src\glib\GException.d(40): Failed to import: No such file or directory
----------------
0x00430569
0x00402065
0x004020D8
0x0040275F
0x00402660
0x004020F7
0x740F38F4 in BaseThreadInitThunk
0x76F85DE3 in RtlUnicodeStringToInteger
0x76F85DAE in RtlUnicodeStringToInteger
error: the process (C:\Users\Standardbenutzer\Documents\Dlang_Projects\GTKD_Test.exe) has returned the signal 1

But if i execute the app my hand (in the windows command window or my double click) it works as expected (so no error)? Why is that?
June 15, 2016
On Wednesday, 15 June 2016 at 09:48:19 UTC, TheDGuy wrote:
> But if i execute the app my hand (in the windows command window or my double click) it works as expected (so no error)? Why is that?

My first guess would be that Coedit does not use the directory where the executable is located as working directory. You can check what getcwd returns:
https://dlang.org/phobos/std_file.html#.getcwd
June 15, 2016
On Wednesday, 15 June 2016 at 10:21:20 UTC, Rene Zwanenburg wrote:
> On Wednesday, 15 June 2016 at 09:48:19 UTC, TheDGuy wrote:
>> But if i execute the app my hand (in the windows command window or my double click) it works as expected (so no error)? Why is that?
>
> My first guess would be that Coedit does not use the directory where the executable is located as working directory. You can check what getcwd returns:
> https://dlang.org/phobos/std_file.html#.getcwd

Thanks a lot for your answer, getcwd() returns the path where coedit is located on my harddrive:
C:\Program Files (x86)\Coedit_32\coedit.2update6.win32

How can i change that?
June 15, 2016
On Wednesday, 15 June 2016 at 10:31:18 UTC, TheDGuy wrote:
> Thanks a lot for your answer, getcwd() returns the path where coedit is located on my harddrive:
> C:\Program Files (x86)\Coedit_32\coedit.2update6.win32
>
> How can i change that?

I'm not familiar with Coedit, but the run options seem to contain a field for setting it:
https://github.com/BBasile/Coedit/wiki#run-options

You may be able to use the symbolic strings there:
https://github.com/BBasile/Coedit/wiki#symbolic-strings
June 15, 2016
On Wednesday, 15 June 2016 at 13:15:56 UTC, Rene Zwanenburg wrote:
> I'm not familiar with Coedit, but the run options seem to contain a field for setting it:
> https://github.com/BBasile/Coedit/wiki#run-options
>
> You may be able to use the symbolic strings there:
> https://github.com/BBasile/Coedit/wiki#symbolic-strings

I changed the working directory in the native project configuration in "Pre-build process", "Post-build process" and in "Run options" in "default", "debug" and "release" to:

C:\Users\Standardbenutzer\Documents\Dlang_Projects

but i still get:

glib.GException.GException@..\..\..\AppData\Roaming\dub\packages\gtk-d-3.3.1\gtk-d\src\glib\GException.d(40): Failed to import: No such file or directory
----------------
0x0045C39D
0x00402094
0x00402120
0x00403FC7
0x00403EC8
0x00402557
0x740F38F4 in BaseThreadInitThunk
0x76F85DE3 in RtlUnicodeStringToInteger
0x76F85DAE in RtlUnicodeStringToInteger
error: the process (C:\Users\Standardbenutzer\Documents\Dlang_Projects\GTKD_Test.exe) has returned the signal 1



June 15, 2016
On Wednesday, 15 June 2016 at 17:35:32 UTC, TheDGuy wrote:
> On Wednesday, 15 June 2016 at 13:15:56 UTC, Rene Zwanenburg wrote:
>> I'm not familiar with Coedit, but the run options seem to contain a field for setting it:
>> https://github.com/BBasile/Coedit/wiki#run-options
>>
>> You may be able to use the symbolic strings there:
>> https://github.com/BBasile/Coedit/wiki#symbolic-strings
>
> I changed the working directory in the native project configuration in "Pre-build process", "Post-build process" and in "Run options" in "default", "debug" and "release" to:

You just need to change "CurrentDirectory" in the "Run options". The two others are for the process that's executed before and after compiling.

I'm gonna check on Windows today but in the meantime you can try

- sets the output path to to a value that's different from the project file location, e.g bin/name.exe and remove completly the value you've set in "Run Options"\"CurrentDirectory"
- add a trailing back slash to the value in the "Run Options"\"CurrentDirectory"

June 16, 2016
On Wednesday, 15 June 2016 at 23:41:51 UTC, Basile B. wrote:
> On Wednesday, 15 June 2016 at 17:35:32 UTC, TheDGuy wrote:
> I'm gonna check on Windows today but in the meantime you can try
>

I've checked on windows and here is what I can say about the problem.

- Symbolic strings won't work on the "CurrentDirectoy" parameter. This is not handled at all. (you would get an error 267). I'll add the translation code for this parameter but this is for version 3 so not soon.

- I had to verify but the cwd should really be set to the path where the application is output. I mean that it's written so. I don't know what's happening on your system right now. My windows is still win 7 and my dev directory is not in ProgramFiles. And I've tested using this simple project: https://gist.github.com/BBasile/2e110ed48989b53e2a53b57977a81736. You can DL it as a zip, open the .ce file as a project and click "compile project and run" you should see the right CWD written in the messages.

- You can create a launcher in the custom tools, excluding the double quote:
    - as executable type "<CPO>"
    - as CurrentDirectory type "<CPP>"
    - as alias put something like "Run this project"
This will work if the binary is compiled in the same directory as the binary that's produced. Otherwise you can adjust by adding directories after the symbol. (e.g  "<CPP>bin\release").
June 16, 2016
On Thursday, 16 June 2016 at 00:46:44 UTC, Basile B. wrote:
> On Wednesday, 15 June 2016 at 23:41:51 UTC, Basile B. wrote:
>
>
> - You can create a launcher in the custom tools, excluding the double quote:
>     - as executable type "<CPO>"
>     - as CurrentDirectory type "<CPP>"
>     - as alias put something like "Run this project"
> This will work if the binary is compiled in the same directory as the binary that's produced. Otherwise you can adjust by adding directories after the symbol. (e.g  "<CPP>bin\release").

>You just need to change "CurrentDirectory" in the "Run options".

Hm, i don't see "CurrentDirectory" in the run options tab:
https://picload.org/image/rgwaopad/coedit_run_options.png

> - I had to verify but the cwd should really be set to the path where the application is output. I mean that it's written so. I don't know what's happening on your system right now. My windows is still win 7 and my dev directory is not in ProgramFiles.

Everything worked fine for the last projects but as soon as i tried to customize buttons with CSS something is wrong. I just store the Coedit-Program in "ProgramFiles" (because every program i have installed is located there). For my projects i usually use the "document" folder of my user where the ".exe" and ".d" - files are stored.

> And I've tested using this simple project: https://gist.github.com/BBasile/2e110ed48989b53e2a53b57977a81736. You can DL it as a >zip, open the .ce file as a project and click "compile project and run" you should see >the right CWD written in the messages.

I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options?
https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html



June 16, 2016
On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote:
> I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options?
> https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html

That is the correct image link: https://img1.picload.org/image/rgwaopli/coedit_run_options.png
June 16, 2016
On Thursday, 16 June 2016 at 07:51:14 UTC, TheDGuy wrote:
> On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote:
>> I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options?
>> https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html
>
> That is the correct image link: https://img1.picload.org/image/rgwaopli/coedit_run_options.png

Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that the cwd is the path to the application ;)

People often forget that (Generally speaking).
« First   ‹ Prev
1 2