Windows 64

Rainer Schuetze r.sagitario at gmx.de
Mon Oct 7 00:03:32 PDT 2013



On 07.10.2013 03:31, "Casper Færgemand" <shorttail at hotmail.com>" wrote:
> Hey, I've been trying for a while to compile 64 bit programs on a
> Windows 7 platform. The setup is the following:
>
> Version: 2.063.2
> OS: Windows 7 64
> Linked: VS 11 64 bit linker
>
> sc.ini:
>
> [Version]
> version=7.51 Build 020
>
> [Environment]
> LIB="%@P%\..\lib";\dm\lib
> DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import"
> LINKCMD=%@P%\link.exe
> LINKCMD64=%VCINSTALLDIR%\bin\amd64\link.exe
> VCINSTALLDIR=%VCINSTALLDIR%
> WindowsSdkDir=%WindowsSdkDir%
>
>
> Environment variables are as follows:
>
> VCINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
> WindowsSdkDir: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
>
> (I had initially forgot a \ at the end of the environment variables)
>
> On compiling the program "void main() {}" with -m64 -v in Eclipse with
> DDT (same result for command line), I get this thrown back:
>
>
> --------  Build Commands:  --------
> -od"bin"
> -of"bin\temp.exe"
>
> -I"src"
>
> "src\temp.d"
>
> -m64 -v
>
> binary    C:\D\Tools\dmd2\windows\bin\dmd.exe
> version   v2.063.2
> config    C:\D\Tools\dmd2\windows\bin\sc.ini
> parse     temp
> importall temp
> import object
> (C:\D\Tools\dmd2\windows\bin\..\..\src\druntime\import\object.di)
> semantic  temp
> entry     main          src\temp.d
> semantic2 temp
> semantic3 temp
> code      temp
> function  D main
> C:\Program Files (x86)\Microsoft Visual Studio
> 11.0\VC\bin\amd64\link.exe /NOLOGO "bin\temp" /OUT:"bin\temp.exe"
>   "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio
> 11.0\VC\lib\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft
> SDKs\Windows\v7.0A\lib\x64"
> C:\D\Tools\dmd2\windows\bin\..\lib\shell32.lib : warning LNK4003:
> invalid library format; library ignored
> C:\D\Tools\dmd2\windows\bin\..\lib\kernel32.lib : warning LNK4003:
> invalid library format; library ignored
> C:\D\Tools\dmd2\windows\bin\..\lib\shell32.lib : warning LNK4003:
> invalid library format; library ignored
> C:\D\Tools\dmd2\windows\bin\..\lib\kernel32.lib : warning LNK4003:
> invalid library format; library ignored
> phobos64.lib(dmain2_480_47b.obj) : error LNK2019: unresolved external
> symbol IsDebuggerPresent referenced in function _d_run_main
> LIBCMT.lib(a_map.obj) : error LNK2001: unresolved external symbol
> __imp_WideCharToMultiByte
>
> ...
>
> bin\temp.exe : fatal error LNK1120: 103 unresolved externals
> --- errorlevel 1120
>
>
> I took the liberty of removing the mid section, since everything was
> LIBCMT.lib and phobos64.lib things that were unresolved. Any heads up on
> what I need to tinker with?

The linker does not find the import libraries from the Windows SDK, so 
it hits the 32-bit libraries that come with dmd.

The released sc.ini does not work with VS2012+ or a Windows SDK 8, you 
should add the following lines to it:

[Environment64]
LIB=%@P%\..\lib;%VCINSTALLDIR%\lib\amd64;%WindowsSdkDir%\Lib\win8\um\x64
;; for some additional improvements
PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE
DFLAGS=%DFLAGS% -L/OPT:NOICF



More information about the Digitalmars-d-learn mailing list