digitalmars.D.learn - How do I correctly install packages for use with Visual Studio?
- Decabytes (32/32) Oct 16 2022 I'm trying to set up Visual Studio 2022 with Visual D, and I'm
- rikki cattermole (5/11) Oct 16 2022 You don't need to develop with Visual Studio for native executables to
- Mike Parker (5/18) Oct 16 2022 The path should be
- matheus (6/13) Oct 16 2022 I don't know if anything changed significantly, but I used to
- Imperatorn (3/16) Oct 16 2022 I also *highly* recommend WinDbg Preview
- Decabytes (5/18) Oct 16 2022 After some fiddling I got WinDBG up and running. It's not perfect
- Mike Parker (17/19) Oct 16 2022 D doesn't expect them to be anywhere. By default, the compiler
- JN (5/10) Oct 17 2022 I am using Visual Studio Code with code-d plugin and using the
- Guillaume Piolat (16/18) Oct 17 2022 Some recommendation to use Visual Studio:
I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows. I'm confused at what/where exactly D expect files to be for them to considered "installed". [I'm using raylib-d](https://github.com/schveiguy/raylib-d). 1. My "compile and debug" and "compile and run" options both include "-lraylib" I've also tried just "-lib raylib" 2. I have the [raylib source](https://github.com/schveiguy/raylib-d/tree/master/source/raylib) file located in my C:\D\dmd2\src 3. I have "-I% P%\..\..\src\raylib" in my sc.ini file located at C:\D\dmd2\windows\bin. 4. I even have raylib.dll and raylib.lib in the same directory as my d source file. Despite this when I hit the Start button in Visual Studio I get this error ``` Building x64\Debug\chip8.exe... chip8.d(4): Error: unable to read module `raylib` chip8.d(4): Expected 'raylib.d' or 'raylib\package.d' in one of the following import paths: import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import import path[2] = C:\D\dmd2\windows\bin\..\..\src\gtkd import path[3] = C:\D\dmd2\windows\bin\..\..\src\raylib ``` But I do have a package.d located in C:\D\dmd2\src\raylib\package.d. Does anyone know what I did wrong?
Oct 16 2022
On 17/10/2022 12:09 AM, Decabytes wrote:I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows.You don't need to develop with Visual Studio for native executables to debug using it. Build your program with debug symbols (-g) and open the executable as a project. You can then debug it with source code support.
Oct 16 2022
On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:Building x64\Debug\chip8.exe... chip8.d(4): Error: unable to read module `raylib` chip8.d(4): Expected 'raylib.d' or 'raylib\package.d' in one of the following import paths: import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import import path[2] = C:\D\dmd2\windows\bin\..\..\src\gtkd import path[3] = C:\D\dmd2\windows\bin\..\..\src\raylib ``` But I do have a package.d located in C:\D\dmd2\src\raylib\package.d. Does anyone know what I did wrong?Your import paths are wrong. This, for example:import path[3] = C:\D\dmd2\windows\bin\..\..\src\raylibThe path should be C:\D\dmd2\windows\bin\..\..\src\ Ditto for gtkd looks like.
Oct 16 2022
On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows.I don't know if anything changed significantly, but I used to debug on Windows with WinDbg without any IDE. Maybe this is useful: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools Matheus.
Oct 16 2022
On Sunday, 16 October 2022 at 11:42:04 UTC, matheus wrote:On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:I also *highly* recommend WinDbg Preview https://apps.microsoft.com/store/detail/windbg-preview/9PGJGD53TN86I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows.I don't know if anything changed significantly, but I used to debug on Windows with WinDbg without any IDE. Maybe this is useful: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools Matheus.
Oct 16 2022
On Sunday, 16 October 2022 at 11:42:04 UTC, matheus wrote:On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:After some fiddling I got WinDBG up and running. It's not perfect (no syntax highlighting for D is a bummer, but at least I can do some debugging now. Thank youI'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly. It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows.I don't know if anything changed significantly, but I used to debug on Windows with WinDbg without any IDE. Maybe this is useful: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools Matheus.
Oct 16 2022
On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:I'm confused at what/where exactly D expect files to be for them to considered "installed".D doesn't expect them to be anywhere. By default, the compiler will search relative to the current working directory, on any paths configured in dmd's config file, and on any paths you (or your IDE) give it via `-I` on the command line. I strongly recommend against keeping libraries in the dmd source directory. You'll have to copy them over again on every new compiler install. If Visual D doesn't yet support dub (I've not used it in a long while, so I don't know), then it's probably best to set up a common directory somewhere on your system. Just make sure not to put the package directory (e.g., in src/raylib, raylib is the package directory) on the import path, but the root source directory. You'll probably want to keep any compiled library binaries on a common path, too, so that you can configure that in the IDE settings.
Oct 16 2022
On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:It's a double whammy because I've never used Visual Studio before (Just an Emacs Guy), but I need to debug my D programming and according to the [documentation](https://wiki.dlang.org/Debuggers) this is my only option on Windows.I am using Visual Studio Code with code-d plugin and using the standard C++ debugger. Seems to work well enough. Some D-specific constructs like AA look weird at times, but breakpoints work, shows me values of variables, callstacks.
Oct 17 2022
On Sunday, 16 October 2022 at 11:09:31 UTC, Decabytes wrote:I'm trying to set up Visual Studio 2022 with Visual D, and I'm running into issues trying to get my project to build correctly.Some recommendation to use Visual Studio: - tutorial for installation here: https://p0nce.github.io/d-idioms/#Installing-Dlang-on-Windows - then generate a Visual Studio solution with: x86 arch arch, DUB configuration "conf" VisualD project with all deps - if you use libraries that work with DUB they should come with static libs, or have dynamic loaders instead. Building .lib files yourself is just more annoying, and you will have to do it for each system you want to support
Oct 17 2022