Skip to content

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

@MonicaLiu0311

Description

@MonicaLiu0311

See microsoft/vcpkg#43519 for the original issue. Please see the fix at microsoft/vcpkg#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions