dmd linker and compiler

Rainer Schuetze r.sagitario at gmx.de
Mon Nov 25 11:10:41 PST 2013



On 25.11.2013 14:49, Frustrated wrote:
> I had an old dmd2 setup that worked perfectly. I recently installed
> VS2013, SDK 8, DMD 2.064.2, and VS 3.37 on a fresh system.
>
> I copied the project to the HD, updated the sc.ini files and tried to
> compile. Basic projects would compile but my old projects would give
> errors either:
>
> user32.lib not found when trying to use optilink. I spend about 2 hours
> trying various ways to get it to find the user32.lib file. It will only
> look in the project dir. I setup `LIB=` in environment in sc.ini with no
> luck.
>
> In x64 mode, the linker gives an error that dmd.obj could not be found.
> There is no such thing as dmd.obj and I have no idea why it is finding
> this. It could be an issue with visual.d but I see no where that it says
> anything about dmd.obj.

Please check the output in the build log, it contains the actually 
executed command line.

>
> I can't get my old projects to compile. Not that it matters, but here is
> my sc.ini file.
>
> The project seems to compile file but simply won't link because of the
> above 2 issues.

Please also check the settings in Visual Studio under 
"Tools->Options->Project and solutions->Visual D->DMD Directories". 
Depending on the settings there, sc.ini might get ignored.

>
>
> [Version]
> version=7.51 Build 020
>
>
> ; environment for both 32/64 bit
> [Environment]
> WindowsSdkDir=C:\Program Files (x86)\Windows Kits\8.1\Lib\win8\um
> VCINSTALLDIR=D:\Apps\Technical\VS2013\VC\
> DFLAGS=-L/nologo "-I%@P%\..\..\src\phobos"
> "-I%@P%\..\..\src\druntime\import" "-ID:\DLang\Lib"
> LIB="%@P%\..\lib"
>
> [Environment32]
> LIB="%WindowsSdkDir%\x86"
> ; LIB="%@P%\..\lib"

You must use the LIB="%@P%\..\lib" line, the lib folder also contains 
user32.lib in the format appropriate for optlink. The Windows SDK 
contains libraries in COFF format that optlink does not understand. 
(Search for coffimplib to find a converter tool.)


> PATH=%PATH%;%VCINSTALLDIR%\bin\x86;%VCINSTALLDIR%\..\Common7\IDE;"%WindowsSdkDir%\x86";
>
> LINKCMD=%@P%\link.exe
>
>
> [Environment64]
> DFLAGS=%DFLAGS% -L/OPT:NOICF
> LIB="%WindowsSdkDir%\x64";"%@P%\..\lib64"
> PATH=%PATH%;%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\..\Common7\IDE;"%WindowsSdkDir%\x64";
>
> LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
>
>


More information about the Digitalmars-d-learn mailing list