Easier way to add libraries to visual d?

Rainer Schuetze via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 26 10:07:04 PDT 2016



On 26.05.2016 17:11, TheDGuy wrote:
> Hi,
> i use Visual D as a plugin for visual studio to create D applications.
> But what bothers me a bit is that i have to tell visual D the exact link
> to the .lib file for every lib i want to use in the project (!).
> So these are the steps i have to make to get an external lib working:
>
> 1. create a new folder in D:\dmd2\src\ with the name of the library
> 2. edit the 'sc.ini' file in D:\dmd2\windows\bin\ and add
> "-I%@P%\..\..\src\[foldername]" under '[Environment]' for every lib i
> want to use
> 3. add the .lib file to D:\dmd2\windows\lib
> 4. add the path to the lib in visual studio (project properties ->
> Linker -> General -> Library Files)
>
> Why do i have to do that? Why can i not just use one folder for the
> library files in visual d and the compiler searches the .lib files for
> each library which was imported into the project on its own?
>
> Is there an easier way to use libraries?

You don't have to change anything in sc.ini. Just add the import path 
(the folder with the source files of your library) to "Project 
properties -> Compiler -> Additional import paths" and the full path to 
the .lib file to "Library Files". If it contains spaces, use quotes.

If you want to use these libraries in multiple projects, you can also 
setup global search paths in "Tools -> Options -> Projects and Solutions 
-> Visual D Settings -> DMD directories".


More information about the Digitalmars-d-learn mailing list