Thread overview
VisualD + dub generate results in linker error
Sep 16, 2016
Malte Kießling
Sep 16, 2016
Rainer Schuetze
Sep 16, 2016
Malte Kießling
September 16, 2016
Hello,

Ive been using Visual Studio 2015 Community + dmd for quite a while now. Because of the recent death of my SSD however I had to reinstall my whole development toolchain.

I compiled the game engine i am working on from the command line and it worked (dub build).
However using the generated visuald solution (dub generate visuald) i run into the following error:

    LINK : fatal error LNK1104: Datei     "obj\debug\dummy\dragon2d\..\source\game\game.obj,P:\Projects\Dragon2D\engine\Dragon2D.exe,obj\debug\dummy\dragon2d\dragon2d.map,P:\Projects\Dragon2D\.dub\lib\dragon2d_d2dlib.lib+" kann nicht geöffnet werden.
    Building P:\Projects\Dragon2D\engine\Dragon2D.exe failed!


This has not happend before. Again, if i build it from the command line it works out just fine. I put the whole log here: http://pastebin.com/JzGZ6dHP

Also a successfull build on the command line: http://pastebin.com/FX8hN5YA

The dub.json file the project uses: https://github.com/DregginGames/Dragon2D/blob/dev-0.3/dub.json

I use dmd 2.071.1, dub is 1.0.0 and visual d is version 0.3.43.

Has anyone encounterd this before or knows what is happening and can help me?

~mkalte
September 16, 2016

On 16.09.2016 18:15, Malte Kießling wrote:
>     LINK : fatal error LNK1104: Datei
> "obj\debug\dummy\dragon2d\..\source\game\game.obj,P:\Projects\Dragon2D\engine\Dragon2D.exe,obj\debug\dummy\dragon2d\dragon2d.map,P:\Projects\Dragon2D\.dub\lib\dragon2d_d2dlib.lib+"
> kann nicht geöffnet werden.
>     Building P:\Projects\Dragon2D\engine\Dragon2D.exe failed!
>
>


This looks as if the optlink command line is passed to the MS linker. Unfortunately the two programs have the same name (link.exe), so it is usually an issue with the PATH environment variable.

It seems you want to build a Win32 program, so please make sure that "$(DMDInstallDir)\windows\bin" is the first entry of the "Executable Paths" of "Tools->Options->Projects and Solutions->Visual D Settings->DMD Directories->Win32".
September 16, 2016
On Friday, 16 September 2016 at 16:43:42 UTC, Rainer Schuetze wrote:
>
> This looks as if the optlink command line is passed to the MS linker. Unfortunately the two programs have the same name (link.exe), so it is usually an issue with the PATH environment variable.
>

That was the problem, thanks for the info!

> It seems you want to build a Win32 program, so please make sure that "$(DMDInstallDir)\windows\bin" is the first entry of the "Executable Paths" of "Tools->Options->Projects and Solutions->Visual D Settings->DMD Directories->Win32".

This however did not work as expected. I ended up removing the vs dirs completly... hmm. This might run into problems later.