Vulkan-Hpp icon indicating copy to clipboard operation
Vulkan-Hpp copied to clipboard

'PFN_VoidFunction': is not a member of 'vk' when using vulkan.cppm

Open MonicaLiu0311 opened this issue 10 months ago • 5 comments

See https://github.com/microsoft/vcpkg/issues/43519 for the original issue. Please see the fix at https://github.com/microsoft/vcpkg/pull/43676.

Operating system

Windows

Compiler

MSVC

Steps to reproduce the behavior

Running vcpkg in manifest mode including vulkan-headers version 1.4.304.0 Build a module out of vulkan.cppm using the following CMakeLists.txt:

find_package(VulkanHeaders CONFIG REQUIRED)
find_package(Vulkan REQUIRED)

add_library(VulkanHppModule)
add_library(Vulkan::cppm ALIAS VulkanHppModule)

set_target_properties(VulkanHppModule
   PROPERTIES
     CXX_STANDARD_REQUIRED ON
     CXX_EXTENSIONS OFF
     CXX_MODULE_STD OFF
)

target_compile_definitions(VulkanHppModule
   PRIVATE
      VULKAN_HPP_NO_SMART_HANDLE
      VULKAN_HPP_NO_CONSTRUCTORS
   PUBLIC
      VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=0
)

target_compile_features(VulkanHppModule
   PUBLIC
     cxx_std_20
)
target_include_directories(VulkanHppModule
   PRIVATE
   "${Vulkan_INCLUDE_DIR}"
)
target_link_libraries(VulkanHppModule
   PRIVATE
      Vulkan::Headers
      Vulkan::Vulkan
)
target_sources(VulkanHppModule
   PUBLIC
      FILE_SET cxx_modules TYPE CXX_MODULES 
      BASE_DIRS
         "${Vulkan_INCLUDE_DIR}"
      FILES
         "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm"
)

Failure logs

[build] <...>\build\VS2022\vcpkg_installed\x64-windows\include\vulkan\vulkan.cppm(2701): error C2039: 'PFN_VoidFunction': is not a member of 'vk'
[build] <...>\build\VS2022\vcpkg_installed\x64-windows\include\vulkan\vulkan.cppm(29): note: see declaration of 'vk'
[build] <...>\build\VS2022\vcpkg_installed\x64-windows\include\vulkan\vulkan.cppm(2701): error C2873: 'PFN_VoidFunction': symbol cannot be used in a using-declaration

Additional context

  • Editing vulkan.cppm at line 2701 and commenting the using statement fixes the problem

Image

MonicaLiu0311 avatar Feb 10 '25 09:02 MonicaLiu0311

This also affects all consumers of the headers, not just vcpkg.

HildarTheDorf avatar Feb 16 '25 00:02 HildarTheDorf

Result of git bisect points to this commit: https://github.com/KhronosGroup/Vulkan-Headers/commit/d4a196d8c84e032d27f999adcea3075517c1c97f Which seems to be when this using statement was added and copies of function pointer types were added to VULKAN_HPP_NAMESPACE.

However no actual definition of VULKAN_HPP_NAMESPACE::PFN_VoidFunction was added (presumably because PFN_VoidFunction is never actually used by the API).

HildarTheDorf avatar Feb 16 '25 00:02 HildarTheDorf

Moved to Vulkan-Hpp. Vulkan-Headers is purely a publishing mechanism.

oddhack avatar Feb 16 '25 09:02 oddhack

This has been resolved with #2033. Unfortunately, that change didn't make it into the 1.4.304 release of the Vulkan-Headers.

asuessenbach avatar Feb 17 '25 08:02 asuessenbach

Unfortunately, vcpkg updates the vulkan-sdk-* series, the latest version still doesn't include the fix for this error. Will you release a new version of vulkan-sdk-* in the near future.

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO KhronosGroup/Vulkan-Headers
    REF "vulkan-sdk-${VERSION}"
    SHA512 5cc23875fc4f548e6669936d290a05a09da36c2e6b73f1c904fa8b750a3bb695c7ef197ef9a0b788d1bb51021d4dd464f847fcec9909cb867618558b34fbcd6b
    HEAD_REF main
)

Image

MonicaLiu0311 avatar Feb 19 '25 09:02 MonicaLiu0311

Assuming, this is resolved by now.

asuessenbach avatar Apr 29 '25 09:04 asuessenbach