Illegal Filename after basic install and trying Hello World

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Jun 26 14:39:09 UTC 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).




More information about the Digitalmars-d-learn mailing list