Linking issues VisualD generated vs Dub generated projects
ShadoLight
ettienne.gilbert at gmail.com
Fri Nov 29 23:59:24 UTC 2019
On Wednesday, 22 May 2019 at 20:12:49 UTC, Rainer Schuetze wrote:
> On 22/05/2019 19:32, Rainer Schuetze wrote:
>>
>> The VS2015 default for x64 is:
>>
>> $(VCINSTALLDIR)lib\amd64
>> $(UCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x64
>
> Argh, sorry, this is what you get without any Windows SDK
> installed. If the Win10 SDK is detected, this gets added, too:
>
> $(WindowsSdkDir)lib\$(WindowsSdkVersion)\um\x64
>
>>
>> and for Win32-COFF:
>>
>> $(VCINSTALLDIR)lib
>> $(UCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x86
>
> $(WindowsSdkDir)lib\$(WindowsSdkVersion)\um\x86
>
>>
>> Starting with VS2015, the VC runtime requires the universal
>> runtime (UCRT).
>>
>> You can see the resulting paths in the build logs in the
>> output directory. The are passed to the linker with the
>> /LIBPATH option.
Many moons later... on a new clean Win7 x64 laptop with VS2015
Pro I had a chance to start from scratch and see what happens
with the above SDK scenario:
After a "clean" install of DMD (2.089.0) and VisualD (0.50.1), I
got the following VD Library Paths:
Win32:
(empty)
x64:
$(VCINSTALLDIR)lib\amd64
$(UCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x64
Win32-COFF:
$(VCINSTALLDIR)lib
$(UCRTSdkDir)Lib\$(UCRTVersion)\ucrt\x86
I did not get the following 2 paths (you mentioned above) added:
x64:
$(WindowsSdkDir)lib\$(WindowsSdkVersion)\um\x64
Win32-COFF:
$(WindowsSdkDir)lib\$(WindowsSdkVersion)\um\x86
So neither the paths for the Win10 SDK nor Wn8.1 SDK were added.
Creating a Win32 app in VS then fails with "LNK1181: cannot open
input file 'user32.lib'".
Adding the above 2 paths for Win10 SDK does not solve the above
Link error - it still cannot link to 'user32.lib'. From the
calc2.buildlog.html I can see:
/LIBPATHs: C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\lib;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;
C:\Program Files (x86)\Windows Kits\10\lib\\um\x86
This gives the following values:
$(VCINSTALLDIR): C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC
$(UCRTSdkDir): C:\Program Files (x86)\Windows Kits\10
$(UCRTVersion): 10.0.10240.0
$(WindowsSdkDir): C:\Program Files (x86)\Windows Kits\10
$(WindowsSdkVersion):
This seems to indicate VD thinks Win10 SDK is installed. However,
even though there is a "c:\Program Files (x86)\Microsoft
SDKs\Windows\v10.0A\" folder, there is no Lib folder in it
neither any *.lib files.
Searching for 'user32.lib' in C:\Program Files (x86) I get:
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\User32.Lib
c:\Program Files (x86)\Microsoft
SDKs\Windows\v7.1A\Lib\x64\User32.Lib
c:\Program Files (x86)\Windows
Kits\8.1\Lib\winv6.3\um\arm\User32.Lib
c:\Program Files (x86)\Windows
Kits\8.1\Lib\winv6.3\um\x64\User32.Lib
c:\Program Files (x86)\Windows
Kits\8.1\Lib\winv6.3\um\x86\User32.Lib
Replacing $(WindowsSdkDir)lib\$(WindowsSdkVersion)\um\x86 with a
hardcoded "c:\Program Files (x86)\Windows
Kits\8.1\Lib\winv6.3\um\x86\User32.Lib" solves the Linking issue
- app is build and runs successfully.
But this indicates to me that the required SDK on my machine is
actually Win8.1 SDK. And for $(WindowsSdkDir) should be
"c:\Program Files (x86)\Windows Kits\8.1\" and for
$(WindowsSdkVersion) should be "winv6.3".
I cross-checked in VC++ whether these enviro variables are
defined and what their values are in VC++ and get:
$(WindowsSdkDir): "c:\Program Files (x86)\Windows Kits\8.1\"
$(WindowsSdkVersion): Not defined at all.
So it seems VC++ correctly maps to the Win8.1 SDK, but not VD.
I'm actually surprised by this... surely $(WindowsSdkDir) should
be the same for both...?
IS it possible to set/change these enviro variables for VD to
their proper values?
More information about the Digitalmars-d-ide
mailing list