Thread overview
Illegal Filename after basic install and trying Hello World
Jun 26, 2019
Gilbert Fernandes
Jun 26, 2019
Nicholas Wilson
Jun 26, 2019
Gilbert Fernandes
Jun 27, 2019
Jonathan M Davis
June 26, 2019
I am using VS 2019 into which I have C# and C++ active.
Installed the following : DMD 2.086.1 then Visual D 0.50.0
DMD has been installed at the base of C:\ at C:\D

Created a D project, which contains a default Hello world program.
Build fails. Running the program fails.

VS displays the following error :

------ Build started: Project: Test2, Configuration: Debug x64 ------
Building x64\Debug\Test2.exe...
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 8: Illegal Filename
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Besides installing Visual D and creating a new project, done nothing.

I have searched the forum for people with the same problem and found two threads.
https://forum.dlang.org/post/poq048$28mm$1@digitalmars.com
https://forum.dlang.org/post/xmhkgkqujxmzruquecfw@forum.dlang.org

None do help. The option "override linker settings from sc.ini" is nowhere it seems. I have checked both inside the current project properties, and VS settings themselves.

I have the following cmd to build the program in the folder :

set PATH=C:\Program Files (x86)\Visual Studio\VC\bin;C:\Program Files (x86)\Visual Studio\Common7\IDE;C:\Program Files (x86)\Windows Kits\10\bin;C:\D\dmd2\windows\bin;%PATH%
set DMD_LIB=C:\Program Files (x86)\Visual Studio\VC\lib\amd64
set VCINSTALLDIR=C:\Program Files (x86)\Visual Studio\VC\
set VCTOOLSINSTALLDIR=C:\Program Files (x86)\Visual Studio\VC\Tools\MSVC\14.21.27702\
set VSINSTALLDIR=C:\Program Files (x86)\Visual Studio\
set WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
set WindowsSdkVersion=10.0.17763.0
set UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\10\
set UCRTVersion=10.0.17763.0
"C:\Program Files (x86)\VisualD\pipedmd.exe" -deps x64\Debug\Test2.dep dmd -m64 -g -gf -debug -X -Xf"x64\Debug\Test2.json" -c -of"x64\Debug\Test2.obj" Test2.d
if %errorlevel% neq 0 goto reportError

set LIB=C:\D\dmd2\windows\bin\..\lib64
echo. > D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
echo "x64\Debug\Test2.obj" /OUT:"x64\Debug\Test2.exe" user32.lib  >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
echo kernel32.lib  >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
echo legacy_stdio_definitions.lib /LIBPATH:"C:\Program Files (x86)\Visual Studio\VC\lib\amd64" /DEBUG /PDB:"x64\Debug\Test2.pdb" /INCREMENTAL:NO /NOLOGO /noopttls /NODEFAULTLIB:libcmt libcmtd.lib /SUBSYSTEM:CONSOLE >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
"C:\Program Files (x86)\VisualD\mb2utf16.exe" D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp

"C:\Program Files (x86)\VisualD\pipedmd.exe" -msmode -deps x64\Debug\Test2.lnkdep C:\D\dmd2\windows\bin\link.exe @D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
if %errorlevel% neq 0 goto reportError
if not exist "x64\Debug\Test2.exe" (echo "x64\Debug\Test2.exe" not created! && goto reportError)

goto noError

:reportError
echo Building x64\Debug\Test2.exe failed!

:noError

Typing "link" seems to launch the D Optilink Linker by default on my CMD.
If I understand properly, I should be using the VS C++ supplied linker ?

Inside VS settings I have the following in the DMD Directories :

Win32 Executable Paths :
$(VCINSTALLDIR)bin
$(VSINSTALLDIR)Common7\IDE
$(WindowsSdkDir)bin
$(DMDInstallDir)windows\bin

x64 has the same ones, but a library path defined :
$(VCINSTALLDIR)lib\amd64

And the following linker is defined :
C:\D\dmd2\windows\bin\link.exe

I don't know how to fix this.

Should this work after a basic Visual D install or there are some configurations steps I missed ?

June 26, 2019
On Wednesday, 26 June 2019 at 13:57:22 UTC, Gilbert Fernandes wrote:
> I am using VS 2019 into which I have C# and C++ active.
> Installed the following : DMD 2.086.1 then Visual D 0.50.0
> DMD has been installed at the base of C:\ at C:\D
>
> Created a D project, which contains a default Hello world program.
> Build fails. Running the program fails.
>
> VS displays the following error :
>
> ------ Build started: Project: Test2, Configuration: Debug x64 ------
> Building x64\Debug\Test2.exe...
> OPTLINK (R) for Win32  Release 8.00.17
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> OPTLINK : Error 8: Illegal Filename
> ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
>
> Besides installing Visual D and creating a new project, done nothing.
>
> I have searched the forum for people with the same problem and found two threads.
> https://forum.dlang.org/post/poq048$28mm$1@digitalmars.com
> https://forum.dlang.org/post/xmhkgkqujxmzruquecfw@forum.dlang.org
>
> None do help. The option "override linker settings from sc.ini"

it may be called dmd.conf (it is on my Mac, but the windows may be different)

> is nowhere it seems. I have checked both inside the current project properties, and VS settings themselves.
>
> I have the following cmd to build the program in the folder :
>
> set PATH=C:\Program Files (x86)\Visual Studio\VC\bin;C:\Program Files (x86)\Visual Studio\Common7\IDE;C:\Program Files (x86)\Windows Kits\10\bin;C:\D\dmd2\windows\bin;%PATH%
> set DMD_LIB=C:\Program Files (x86)\Visual Studio\VC\lib\amd64
> set VCINSTALLDIR=C:\Program Files (x86)\Visual Studio\VC\
> set VCTOOLSINSTALLDIR=C:\Program Files (x86)\Visual Studio\VC\Tools\MSVC\14.21.27702\
> set VSINSTALLDIR=C:\Program Files (x86)\Visual Studio\
> set WindowsSdkDir=C:\Program Files (x86)\Windows Kits\10\
> set WindowsSdkVersion=10.0.17763.0
> set UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\10\
> set UCRTVersion=10.0.17763.0
> "C:\Program Files (x86)\VisualD\pipedmd.exe" -deps x64\Debug\Test2.dep dmd -m64 -g -gf -debug -X -Xf"x64\Debug\Test2.json" -c -of"x64\Debug\Test2.obj" Test2.d
> if %errorlevel% neq 0 goto reportError
>
> set LIB=C:\D\dmd2\windows\bin\..\lib64
> echo. > D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
> echo "x64\Debug\Test2.obj" /OUT:"x64\Debug\Test2.exe" user32.lib  >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
> echo kernel32.lib  >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
> echo legacy_stdio_definitions.lib /LIBPATH:"C:\Program Files (x86)\Visual Studio\VC\lib\amd64" /DEBUG /PDB:"x64\Debug\Test2.pdb" /INCREMENTAL:NO /NOLOGO /noopttls /NODEFAULTLIB:libcmt libcmtd.lib /SUBSYSTEM:CONSOLE >> D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
> "C:\Program Files (x86)\VisualD\mb2utf16.exe" D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
>
> "C:\Program Files (x86)\VisualD\pipedmd.exe" -msmode -deps x64\Debug\Test2.lnkdep C:\D\dmd2\windows\bin\link.exe @D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp
> if %errorlevel% neq 0 goto reportError
> if not exist "x64\Debug\Test2.exe" (echo "x64\Debug\Test2.exe" not created! && goto reportError)
>
> goto noError
>
> :reportError
> echo Building x64\Debug\Test2.exe failed!
>
> :noError
>
> Typing "link" seems to launch the D Optilink Linker by default on my CMD.
> If I understand properly, I should be using the VS C++ supplied linker ?

Correct. You have VS, so it is of no use to you. Use the VS one instead of C:\D\dmd2\windows\bin\link.exe in your build file. You can just delete the wrong link.exe any hopefully it will pick up the correct one in the $PATH.

Also any reason why you (or is that visualD doing that? )are manually invoking the linker? Omit -c and dmd will invoke the linker for you (hopefully the correct one).


June 26, 2019
After removing all paths to the linker, the error has changed :

------ Build started: Project: Test2, Configuration: Debug x64 ------
Building x64\Debug\Test2.exe...
TRACKER : error TRK0005: ‚chec de localisation deÿ: "@D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp". Le fichier sp‚cifi‚ est introuvable.

Building x64\Debug\Test2.exe failed!
Details saved as "file://D:\sources_D\Test2\Test2\x64\Debug\Test2.buildlog.html"
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have checked if the rsp file does exist at the indicated path, and it seems so :

D:\>dir D:\sources_D\Test2\Test2\x64\Debug\Test2.link.rsp

 Répertoire de D:\sources_D\Test2\Test2\x64\Debug

26/06/2019  16:43               590 Test2.link.rsp
               1 fichier(s)              590 octets
               0 Rép(s)  62 739 664 896 octets libres

I don't know why but I'm not gonna spend more time on this.

The "dmd" command works fine on command line.
So I'm gonna use Visual Studio Code + use command-line commands
Will make using git easier anyway.

Thanks for the help. I'd rather spend time on learning D than fixing VS weird way to work :p
June 27, 2019
On Wednesday, June 26, 2019 8:39:09 AM MDT Nicholas Wilson via Digitalmars- d-learn wrote:
> On Wednesday, 26 June 2019 at 13:57:22 UTC, Gilbert Fernandes
> > None do help. The option "override linker settings from sc.ini"
>
> it may be called dmd.conf (it is on my Mac, but the windows may
> be different)

On Windows, it's sc.ini, whereas it's dmd.conf on every other platform. I have no clue why Windows is different from the rest.

- Jonathan M Davis