Using GtK

Ruby The Roobster michaeleverestc79 at gmail.com
Tue Aug 24 23:30:22 UTC 2021


On Tuesday, 24 August 2021 at 22:21:44 UTC, Mike Parker wrote:
> On Tuesday, 24 August 2021 at 19:07:11 UTC, Ruby The Roobster 
> wrote:
>
>> Doing this, works though:
>>
>> dub add gtkd-3 at 3.9.0
>> then
>> dub fetch gtkd-3 at 3.9.0
>> then dub test.d
>>
>> Will cause the program to run and execute.  However, it 
>> doesn't save an executable to disk, which is what I want.  Is 
>> there a way, to get it saved to disk?
>
> There's nothing special you have to do. You should always see 
> an executable after invoking dub for a run or build. But you've 
> got some mixed-up commands here.
>
> 1. dub add requires a dub.json/sdl. I assume you have one, else 
> the invocation would fail. But if you do, you aren't using it 
> because of your invocation of `dub test.d` (see point 3 below).
> 2. dub fetch is not needed after dub add. If a dependency is 
> added to your config file, dub will fetch it automatically.
> 3. dub test.d is for building a single file. To do that, you 
> have to add your dub config in a comment at the top of the 
> source file rather than as a separate dub.json/sdl. If you try 
> to invoke dub with a source file name and there is no config at 
> the top of the file, then the invocation will fail. And if you 
> do have this, then your invocation of dub add isn't doing 
> anything for you---it won't add dependencies to single-file 
> configs.
>
> If the first and last invocations really are succeeding, then 
> it looks like you've got both a dub.json/sdl *and* a 
> single-file config. And in that case, your dub.json/sdl isn't 
> doing anything and dub is using the config at the top of 
> test.d. And you should see an executable next to test.d after 
> it completes.
>
> So this is all rather confusing looking only at these command 
> lines. How exactly have you configured this? What does test.d 
> look like?

I changed test.d to be the same code as in the 
HelloWorld.d(https://github.com/gtkd-developers/GtkD/blob/master/demos/gtk/HelloWorld.d)example that is provided by the GtkD github.  Adding the comment to the top of the file and removing the .json doesn't change what happens.  Dub runs the program, but an executable file doesn't pop up next to it.  Running ./test in the terminal returns a no file or directory error.  Another thing. Apparently dub run is the default command, but running dub run test.d gives an error that the package test could not be found.  Same with dub build.  Running dub test.d still works just fine, for some reason.


More information about the D.gnu mailing list