www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Easier way to add libraries to visual d?

reply TheDGuy <a.b gmail.com> writes:
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?
May 26 2016
next sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 15:11:05 UTC, 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?
Use Coedit: the widget "library manager" allow to register libraries in a single click and then they are usable on the fly, in the projects or in a runnable modules, without specifying anything (except a (*) in a project setting called "libraryAliases". https://github.com/BBasile/Coedit/wiki#library-manager-widget It was especially designed because the other IDE suck a bit with static libraries.
May 26 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 15:21:40 UTC, Basile B. wrote:
 Use Coedit: the widget "library manager" allow to register 
 libraries in a single click and then they are usable on the 
 fly, in the projects or in a runnable modules, without 
 specifying anything (except a (*) in a project setting called 
 "libraryAliases".

 https://github.com/BBasile/Coedit/wiki#library-manager-widget

 It was especially designed because the other IDE suck a bit 
 with static libraries.
Thanks for the tip. I downloaded the version for windows from github and it works fine so far but if i want to "run compiled file" i get the message 'the executino of a runnable module has been implicitly aborted" even though i can run the .exe file manually without any errors. Do you know how i can run my app from out of coedit?
May 26 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 15:41:45 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 15:21:40 UTC, Basile B. wrote:
 Use Coedit: the widget "library manager" allow to register 
 libraries in a single click and then they are usable on the 
 fly, in the projects or in a runnable modules, without 
 specifying anything (except a (*) in a project setting called 
 "libraryAliases".

 https://github.com/BBasile/Coedit/wiki#library-manager-widget

 It was especially designed because the other IDE suck a bit 
 with static libraries.
Thanks for the tip. I downloaded the version for windows from github and it works fine so far but if i want to "run compiled file" i get the message 'the executino of a runnable module has been implicitly aborted" even though i can run the .exe file manually without any errors. Do you know how i can run my app from out of coedit?
Yes and no - CE Projects and DUB projects are always run outside (by deafault) - runnable modules can be run outside using: "Compile file and run outside". It's because runnable modules are different from projects. They are usually compiled so fast that you can recompile before each execution but you can open a GH issue and ask for a new action "run compiled file outside" (to split the action in two phases) When they are run inside, you can use the "Input process" widget to pass some input to the process that's hosted (see the "Windows" menu). To register a DUB package, you can either fetch (DUB icon) or clone the repo, open the DUB JSON project, compile the right config, then in the libman there's a icon with a gray chain over a book. Click this icon and the library is registered. Note that DUB projects are displayed in another widget that the one displayed by default at the right (see "DUB project editor") in the "Windows" menu.
May 26 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote:
 To register a DUB package, you can either fetch (DUB icon) or 
 clone the repo, open the DUB JSON project, compile the right 
 config, then in the libman there's a icon with a gray chain 
 over a book. Click this icon and the library is registered.
Where? I searched for 10 minutes and can't find any DUB button besides the dub project editor. If i create a new DUB project it looks like that everything is locked (for example native project configuration)?
May 26 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 16:21:30 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote:
 To register a DUB package, you can either fetch (DUB icon) or 
 clone the repo, open the DUB JSON project, compile the right 
 config, then in the libman there's a icon with a gray chain 
 over a book. Click this icon and the library is registered.
Where? I searched for 10 minutes and can't find any DUB button besides the dub project editor. If i create a new DUB project it looks like that everything is locked (for example native project configuration)?
- Registering a dub package from online is in the "library manager" - The DUB project editor is a widget that's not docked by default, see in the menu "Windows", the item "Dub project editor". The Native project configuration and editor is for the native project format (which is another format than DUB, just like vsprojects are another format).
May 26 2016
next sibling parent Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote:
 On Thursday, 26 May 2016 at 16:21:30 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 16:01:22 UTC, Basile B. wrote:
 To register a DUB package, you can either fetch (DUB icon) or 
 clone the repo, open the DUB JSON project, compile the right 
 config, then in the libman there's a icon with a gray chain 
 over a book. Click this icon and the library is registered.
Where? I searched for 10 minutes and can't find any DUB button besides the dub project editor. If i create a new DUB project it looks like that everything is locked (for example native project configuration)?
- Registering a dub package from online is in the "library manager" - The DUB project editor is a widget that's not docked by default, see in the menu "Windows", the item "Dub project editor". The Native project configuration and editor is for the native project format (which is another format than DUB, just like vsprojects are another format).
By the way everything is explained in the wiki. If the browser didn't display the right anchor click F5. This happens because everything is in a big single page: https://github.com/BBasile/Coedit/wiki#library-manager-widget
May 26 2016
prev sibling parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote:
 - Registering a dub package from online is in the "library 
 manager"
 - The DUB project editor is a widget that's not docked by 
 default, see in the menu "Windows", the item "Dub project 
 editor".

 The Native project configuration and editor is for the native 
 project format (which is another format than DUB, just like 
 vsprojects are another format).
Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port ~master... Placing serial-port ~master to C:\Users\luc\AppData\Roaming\dub\packages\... Neither a package description file, nor source/app.d was found in C:\Users\luc\AppData\Roaming\dub\packages\serial-port-master Please run DUB from the root directory of an existing package, or run "dub init --help" to get information on creating a new package. No valid root package found - aborting. error, failed to compile the package to register
May 26 2016
next sibling parent TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote:
 Thanks, now i found it.

 If i try to add for example 'colorize' as a package i get:

 Fetching serial-port ~master...
 Placing serial-port ~master to 
 C:\Users\luc\AppData\Roaming\dub\packages\...

 Neither a package description file, nor source/app.d was found 
 in
 C:\Users\luc\AppData\Roaming\dub\packages\serial-port-master
 Please run DUB from the root directory of an existing package, 
 or run
 "dub init --help" to get information on creating a new package.

 No valid root package found - aborting.
 error, failed to compile the package to register
I mean 'serial-port', sry.
May 26 2016
prev sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote:
 [...]
Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port ~master... Placing serial-port ~master to C:\Users\luc\AppData\Roaming\dub\packages\... Neither a package description file, nor source/app.d was found in C:\Users\luc\AppData\Roaming\dub\packages\serial-port-master Please run DUB from the root directory of an existing package, or run "dub init --help" to get information on creating a new package. No valid root package found - aborting. error, failed to compile the package to register
colorize works. You meant "serial-port" ?
May 26 2016
next sibling parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Well, i get the same message for both packages...Even though it creates a new folder with all the files in AppData\Roaming\dub\packages
May 26 2016
next sibling parent Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 17:09:03 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Well, i get the same message for both packages...Even though it creates a new folder with all the files in AppData\Roaming\dub\packages
Can you create a GH issue ? I'll fix it ASAP. That's a desatrous bug. version 2 update 5 should have been the latest before monthes.
May 26 2016
prev sibling next sibling parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 17:09:03 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Well, i get the same message for both packages...Even though it creates a new folder with all the files in AppData\Roaming\dub\packages
I'm on Windows now. I'm sorry but both packages were setup successfully. What you can do is the other way: - clone the git repos. - open the DUB json as project. - choose the right config in the inspector. - compile. - while the project for the lib to reg is still open, register in the library manager using the book-link icon. You have well version 2 update 5 ?
May 26 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 17:25:25 UTC, Basile B. wrote:
 I'm on Windows now. I'm sorry but both packages were setup 
 successfully.

 What you can do is the other way:
 - clone the git repos.
 - open the DUB json as project.
 - choose the right config in the inspector.
 - compile.
 - while the project for the lib to reg is still open, register 
 in the library manager using the book-link icon.

 You have well version 2 update 5 ?
Yes. So do you have any idea how i could get this to work? It would be nice to link libraries directly from the IDE but for the time being linking the project manually with the files on my harddrive is no problem.
May 26 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 19:07:42 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:25:25 UTC, Basile B. wrote:
 I'm on Windows now. I'm sorry but both packages were setup 
 successfully.

 What you can do is the other way:
 - clone the git repos.
 - open the DUB json as project.
 - choose the right config in the inspector.
 - compile.
 - while the project for the lib to reg is still open, register 
 in the library manager using the book-link icon.

 You have well version 2 update 5 ?
Yes. So do you have any idea how i could get this to work? It would be nice to link libraries directly from the IDE but for the time being linking the project manually with the files on my harddrive is no problem.
I'll release a hotfix tonight, so you'll be able to give Coedit another try if you're not already too much disapointed. But the procedure I described is very easy. you just have to clone, compile and click a button in the library manager. It's even better because you can choose which version to compile by "git checkout vx.x.x" while using the "DUB button" it's always the master version that get fetched (this is a limitation). One thing that's important to get (sorry if I heavily advertise Coedit...) is that the libman is a central component, everything rely on this (CE projects, ease of compilation of the "runnables", and super important: DCD). That's also why it's split from the project editors.
May 26 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 20:25:43 UTC, Basile B. wrote:
 But the procedure I described is very easy. you just have to 
 clone, compile and click a button in the library manager. It's 
 even better because you can choose which version to compile by 
 "git checkout vx.x.x" while using the "DUB button" it's always 
 the master version that get fetched (this is a limitation).
I tried this with the gfm-package. I opened the dub.json file as a project and clicked 'Compilation'-> 'Compile Project' then it did its things: compiling C:\Users\stduser\Downloads\DUB\GFM\dub.json Fetching derelict-util 2.0.6 (getting selected version)... Placing derelict-util 2.0.6 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching derelict-gl3 1.0.18 (getting selected version)... Placing derelict-gl3 1.0.18 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching derelict-sdl2 1.9.7 (getting selected version)... Placing derelict-sdl2 1.9.7 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching derelict-assimp3 1.0.1 (getting selected version)... Placing derelict-assimp3 1.0.1 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching gfm 6.0.2 (getting selected version)... Placing gfm 6.0.2 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching derelict-fi 2.0.2 (getting selected version)... Placing derelict-fi 2.0.2 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Fetching colorize 1.0.5 (getting selected version)... Placing colorize 1.0.5 to C:\Users\Standardbenutzer\AppData\Roaming\dub\packages\... Performing "plain" build using C:\D\dmd2\windows\bin\dmd.exe for x86. derelict-util 2.0.6: building configuration "library"... derelict-assimp3 1.0.1: building configuration "library"... gfm:assimp 6.0.2: building configuration "library"... gfm:core 6.0.2: building configuration "library"... derelict-fi 2.0.2: building configuration "library"... gfm:freeimage 6.0.2: building configuration "library"... gfm:integers 6.0.2: building configuration "library"... colorize 1.0.5: building configuration "library"... gfm:logger 6.0.2: building configuration "library"... gfm:math 6.0.2: building configuration "library"... derelict-gl3 1.0.18: building configuration "library"... gfm:opengl 6.0.2: building configuration "library"... derelict-sdl2 1.9.7: building configuration "library"... gfm:sdl2 6.0.2: building configuration "library"... gfm_test ~master: building configuration "application"... C:\Users\stduser\Downloads\DUB\GFM\dub.json has been successfully compiled but if i go to 'Windows'->'Library Manager' the book icon is gray and not clickable. https://picload.org/image/rgcccpci/library_manager.png
May 26 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 20:46:31 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 20:25:43 UTC, Basile B. wrote:
 [...]
I tried this with the gfm-package. I opened the dub.json file as a project and clicked 'Compilation'-> 'Compile Project' then it did its things: [...]
gfm doesn't yield a .lib because of this: https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22 it should be "library" or staticLibrary or "sourceLibrary" thus it can't be registered. Bad luck here you've chosen the wrong stuff to test.
May 26 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 22:15:17 UTC, Basile B. wrote:
 gfm doesn't yield a .lib because of this:

 https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22

 it should be "library" or staticLibrary or "sourceLibrary"

 thus it can't be registered. Bad luck here you've chosen the 
 wrong stuff to test.
Okay, i now tried requests and serial-port and with both i have the same problem that i can't add them to the library manager.
May 27 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Friday, 27 May 2016 at 19:30:10 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 22:15:17 UTC, Basile B. wrote:
 gfm doesn't yield a .lib because of this:

 https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22

 it should be "library" or staticLibrary or "sourceLibrary"

 thus it can't be registered. Bad luck here you've chosen the 
 wrong stuff to test.
Okay, i now tried requests and serial-port and with both i have the same problem that i can't add them to the library manager.
I've released a hot fix yesterday and now it works with latest DUB tag (0.9.25). But registering from the project that's loaded was already working yesterday. I think that you have forgotten to choose the right configuration to compile, example with serial-port: http://imgur.com/7wAwqPz - open the dub json - to the left, the DUB inspector: the green arrow must be on a config that's dedicated to build the library - double click to select a config - compile the project - to the bottom library manager: click the icon with a book and link on the top
May 28 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Saturday, 28 May 2016 at 13:25:14 UTC, Basile B. wrote:
 I've released a hot fix yesterday and now it works with latest 
 DUB tag (0.9.25).

 But registering from the project that's loaded was already 
 working yesterday. I think that you have forgotten to choose 
 the right configuration to compile, example with serial-port:

 http://imgur.com/7wAwqPz

 - open the dub json
 - to the left, the DUB inspector: the green arrow must be on a 
 config that's dedicated to build the library
 - double click to select a config
 - compile the project
 - to the bottom library manager: click the icon with a book and 
 link on the top
Thanks a lot for the fast hot fix, now everything works fine! :) Great IDE!
May 28 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Saturday, 28 May 2016 at 15:29:36 UTC, TheDGuy wrote:
 Thanks a lot for the fast hot fix, now everything works fine! 
 :) Great IDE!
Do you mind implementing an option to reset the layout to default? Because i think i messed up and no i don't know how i can get the file view for the project (which was originally on the left side) back?
May 28 2016
parent Basile B. <b2.temp gmx.com> writes:
On Saturday, 28 May 2016 at 15:31:18 UTC, TheDGuy wrote:
 On Saturday, 28 May 2016 at 15:29:36 UTC, TheDGuy wrote:
 Thanks a lot for the fast hot fix, now everything works fine! 
 :) Great IDE!
Do you mind implementing an option to reset the layout to default? Because i think i messed up and no i don't know how i can get the file view for the project (which was originally on the left side) back?
You must delete the option file that's name "docking.xml", so under windows in the folder appdata\roaming\coedit. Once done, rebuild your layout and most important: 'lock it' ! It also happened to me some time to time. See also the wiki: https://github.com/BBasile/Coedit/wiki#docking Another way to preserve the docking is to kill the application by hand, so that the new xml is not written. But this is not always doable since in this case no settings are saved at all (e.g if a new custom tool was added or a new libman entry then they're lost).
May 28 2016
prev sibling parent Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 17:09:03 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Well, i get the same message for both packages...Even though it creates a new folder with all the files in AppData\Roaming\dub\packages
I confirm there is a bug. It's due to a DUB breaking change from 0.9.24-rc4 to 0.9.24. (everything is placed in a sub folder that has the same name of the package).
May 26 2016
prev sibling next sibling parent Basile B. <b2.temp gmx.com> writes:
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 On Thursday, 26 May 2016 at 17:02:06 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 16:53:42 UTC, Basile B. wrote:
 [...]
Thanks, now i found it. If i try to add for example 'colorize' as a package i get: Fetching serial-port ~master... Placing serial-port ~master to C:\Users\luc\AppData\Roaming\dub\packages\... Neither a package description file, nor source/app.d was found in C:\Users\luc\AppData\Roaming\dub\packages\serial-port-master Please run DUB from the root directory of an existing package, or run "dub init --help" to get information on creating a new package. No valid root package found - aborting. error, failed to compile the package to register
colorize works. You meant "serial-port" ?
serial-port worked too here. I'm on linux (and CE is mostly developed on this platform) so it could be a bug (to verify).
May 26 2016
prev sibling parent reply TheDGuy <a.b gmail.com> writes:
On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Does Coedit have the possibility to debug?
Jun 03 2016
parent reply TheDGuy <a.b gmail.com> writes:
On Friday, 3 June 2016 at 16:20:53 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Does Coedit have the possibility to debug?
Yes / No?
Jun 07 2016
parent Basile B. <b2.temp gmx.com> writes:
On Tuesday, 7 June 2016 at 08:49:16 UTC, TheDGuy wrote:
 On Friday, 3 June 2016 at 16:20:53 UTC, TheDGuy wrote:
 On Thursday, 26 May 2016 at 17:06:03 UTC, Basile B. wrote:
 colorize works. You meant "serial-port" ?
Does Coedit have the possibility to debug?
Yes / No?
No
Jun 07 2016
prev sibling parent Rainer Schuetze <r.sagitario gmx.de> writes:
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".
May 26 2016