DUB: How to link an external library on Windows 10?

Ki Rill rill.ki at yahoo.com
Fri Aug 27 13:41:56 UTC 2021


On Friday, 27 August 2021 at 13:33:25 UTC, Mike Parker wrote:
> On Friday, 27 August 2021 at 13:21:04 UTC, Ki Rill wrote:
>> I have a Raylib project on Windows using DUB. I've added 
>> raylib-d via `dub add`. But what I can't figure out is how to 
>> tell DUB to link against raylib library.
>>
>> I have the following project structure:
>> ```
>> -> source
>> ---> app.d
>> -> libraylib.a
>> -> raylib.dll
>> -> etc...
>> ```
>>
>> I'd like to use either .a or .dll. Do you have any ideas?
>
> raylib.a isn't going to get you anywhere. You'll run into 
> issues mixing MinGW-compiled libraries.
>
> If raylib doesn't ship precompiled VS binaries, then, assuming 
> you have Visual Studio (or the MS Build tools) installed, you 
> should compile Raylib with that same version. Then you'll have 
> a new raylib.dll and a raylib.lib. Add raylib.lib to your dub 
> config via the "libs" directive.

I have downloaded the pre-compiled binaries from the official 
[Raylib ](https://github.com/raysan5/raylib/releases/tag/3.7.0) 
repo.

I'm not using Visual Studio. Only dub and a text editor.


More information about the Digitalmars-d-learn mailing list