How do I install a library?

Steven Schveighoffer schveiguy at gmail.com
Thu Nov 8 23:07:42 UTC 2018


On 11/8/18 5:46 PM, Murilo wrote:
> On Thursday, 8 November 2018 at 22:28:38 UTC, Steven Schveighoffer wrote:
>> On 11/8/18 4:46 PM, Murilo wrote:
>>> I want to install the library DlangUI but I don't know how to do it. 
>>> In python I just type pip <pckg> and it works, but in D I don't know 
>>> how to do it. Can anyone help me?
>>
>> dlangui will be fetched if you make it a dependency of your project.
>>
>> When you run dub init on your project, it will ask for dependencies, 
>> just type dlangui in there.
>>
> 
> Thanks, I tried that but when I add the import dlangui in the beginning 
> it doesn't work. I wanted to just type import dlangui in the beginning 
> of the file so I can call the dlangui functions.

D uses dub and code.dlang.org to fetch dependencies (similar to python 
or other ecosystems).

If you are using dub to build your project, just add dlangui as a 
dependency, and you can then import and use it. This goes in your 
dub.json or dub.sdl file. See documentation here: 
http://code.dlang.org/getting_started

If you want to build the dlangui library directly and install it on your 
own without dub, you would need to download the source (probably from 
github) and build it using dub.

-Steve


More information about the Digitalmars-d-learn mailing list