A C++ project built successfully with CONNECT Update 4 SDK is failing to link correctly with CONNECT Update 5 SDK. The problem concerns Win32 libraries (despite the name, these really are 64-bit Windows libraries — complain to Microsoft if you believe that to be confusing).
Here's the relevant part of my bmake file that concerns linking. Note that the Win32 lib path is explicitly set...
# Bentley libraries LINKER_LIBRARIES + $(mdlLibs)bentley.lib ... LINKER_LIBRARIES + $(mdlLibs)ECObjects.lib # Win32 libraries LINKER_LIBRARIES + $(platformSdkLibs)Shlwapi.lib LINKER_LIBRARIES + $(platformSdkLibs)Shell32.lib LINKER_LIBRARIES + $(platformSdkLibs)Gdi32.lib
When I build the project, the linker complains that it can't find some library files...
C:\PROGRA~2\MIA713~1\Windows\v7.1A\Lib\x64\Shlwapi.lib C:\PROGRA~2\MIA713~1\Windows\v7.1A\Lib\x64\Shell32.lib C:\PROGRA~2\MIA713~1\Windows\v7.1A\Lib\x64\Gdi32.lib gdi32.lib user32.lib kernel32.lib G:\PROGRA~2\VIC266~1\VC\\lib\amd64\msvcrt.lib G:\PROGRA~1\Bentley\MICROS~2\SDK\library\mdlbltin.lib LINK : fatal error LNK1181: cannot open input file 'gdi32.lib'
Note that the linker has found the Shlwapi, Shell32 and Gdi32 libraries because I've explicitly told it where to find them. What I don't understand is where the references to gdi32, user32 and kernel32 libraries have come from. I can understand the the linker doesn't find those because no folder is specified — but where did they come from? I repeat that this project used to build correctly with CONNECT Update 4 and that this problem has arisen after moving to Update 5.
Can I specify a default folder for the linker to search? The files not found are all present in the same folder as those I explicitly qualified with the path C:\PROGRA~2\MIA713~1\Windows\v7.1A\Lib\x64 (which is the DOS\X version of C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64).
Hi Jon,
MicroStation CONNECT Edition Update 5 SDK based on Visual Studio 2015 has a couple additional Visual Studio installer features that are not enabled by default for C++ developers. :(
When installing or modifying your Microsoft Visual Studio 2015 install, make sure you have the following items checked/enabled for install:
With those 2 additional new Microsoft Visual C++ feature requirements installed and available you (and the SDK) should then be able to locate GDI32.LIB (and others) in a pattern similar to:
C:\PROGRA~1\Bentley\MICROS~2\examples>sdklib C:\PROGRA~1\Bentley\MICROS~2\library>f gdi32.lib File Not Found C:\PROGRA~1\Bentley\MICROS~2\library>pushd %WindowsSdkDir% C:\Program Files (x86)\Windows Kits\10>f gdi32.lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\arm\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\arm64\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\arm\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\arm64\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64\Gdi32.Lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86\Gdi32.Lib
If you have tried some of the "SDKMACROS" and find them helpful e.g. VSDIR, VCLIB, etc.; I will add another to make jumping to the Windows Kits directory easier providing a new: VSKITS macro. Hopefully we don't need to use these too much, but may be helpful when we do.
As for why MSCE SDK U5 (VS2015) projects vs. MSCE SDK U4 (VS2013) are requiring GDI32.lib and others you list; I will see if I can find a bit of time to identify that dependency and update this thread with that information.
HTH,Bob
Answer Verified By: Jon Summers
Unknown said:C:\PROGRA~1\Bentley\MICROS~2\library>pushd %WindowsSdkDir%
I can see WindowsSdkDir defined in the developer shell, but I don't see it in MicroStationDeveloperShell.bat. How is that variable defined?
Regards, Jon Summers LA Solutions
Unknown said:Windows and Web Development > Universal Windows App Development Tools > Windows 10 SDK
I'm pleased to report that installing that additional Viz Studio 2015 component has solved my problem. The app. now builds to completion.