swift-win32: error: use of unresolved identifier 'DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2'

I’m getting this error after running the following commands:

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release . -D CMAKE_Swift_FLAGS="-sdk %SDK% -I %SDK%/usr/lib/swift -L %SDK%/usr/lib/swift/%OS%"
ninja -C build SwiftWin32 HelloSwift

I’ve run curl -sL "https://raw.githubusercontent.com/apple/swift/master/stdlib/public/Platform/winsdk.modulemap" -o "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" in an administrator Developer prompt and it made no difference.

Is there a different/newer/older modulemap I need to clone?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Im planning on making some more improvements to the build, so LMK if you run into issues.

@compnerd figured it out. I needed to place that change in Sources/Support/WinSDK+Extensions.swift rather than Sources/Application/Application.swift since the former imports WinSDK. It builds now. That’s what you did in the commit; I don’t know how I missed that.

Bleh, this is a compatibility issue. DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 doesn’t get pulled in correctly from the clang importer. We should provide a definition for it in WinSDK+Extensions.swift for compatibility. Thanks for the report!