vulkan_win32.h 未被“识别”。

huangapple go评论87阅读模式
英文:

vulkan_win32.h is not "recognized"

问题

这些错误似乎是与 Windows 上的 Vulkan 实现有关。VS Code 终端显示了一系列错误,指向了 vulkan_win32.h 文件中的未知类型名问题。这可能是由于缺少 Windows 上的头文件或相关库。

vulkaninfo 显示了一些警告,指出了一些不良层文件版本可能引起的问题。

你提供的 Vulkan 配置信息表明了 Vulkan 实例版本以及一系列扩展,看起来似乎安装了最新的 Vulkan SDK。

你尝试按照一个 Stack Overflow 上的建议,但遇到了 Windows 不允许删除注册表的问题。

问题可能源于缺少某些系统级别的设置或配置。建议尝试以下解决方案:

  • 确保你的 Vulkan SDK 安装正确并与你的系统兼容。
  • 检查你的开发环境设置是否完整,包括所需的头文件和库文件。
  • 检查 Vulkan 驱动程序是否正确安装并与你的显卡兼容。
  • 确保你的系统环境变量设置正确,指向 Vulkan SDK 所需的路径。
  • 在 Stack Overflow 或 Vulkan 论坛上发布你遇到的问题,寻求更多的帮助。

这些错误可能是因为缺少必要的系统设置或 Vulkan 库文件,或者可能与系统的兼容性问题有关。寻求专业开发者或相关社区的帮助可能会更有效解决这些问题。

英文:

I'm following this Vulkan tutorial: https://youtu.be/dHPuU-DJoBM, in particular, this video https://youtu.be/6Kj3O2Ov1RU

when I run in VS code, this errors shows (there are a lot of them, but all of the same type), i think is something with Windows implementation(?): log of VS code terminal:

C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:30:5: error: unknown type name 'HINSTANCE'      
    HINSTANCE                       hinstance;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:31:5: error: unknown type name 'HWND'
    HWND                            hwnd;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:57:5: error: unknown type name 'HANDLE'
    HANDLE                                handle;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:58:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                               name;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:64:11: error: unknown type name 'SECURITY_ATTRIBUTES'
    const SECURITY_ATTRIBUTES*    pAttributes;
          ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:65:5: error: unknown type name 'DWORD'
    DWORD                         dwAccess;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:66:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                       name;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:82:136: error: unknown type name 'HANDLE'
  ...*PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* ...                                                                                                                ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:83:135: error: unknown type name 'HANDLE'
  ...*PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE ha...                                                                                                               ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:89:5: error: unknown type name 'HANDLE'
    HANDLE*                                     pHandle);
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:94:5: error: unknown type name 'HANDLE'
    HANDLE                                      handle,
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:125:5: error: unknown type name 'HANDLE'
    HANDLE                                   handle;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:126:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                                  name;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:132:11: error: unknown type name 'SECURITY_ATTRIBUTES'
    const SECURITY_ATTRIBUTES*    pAttributes;
          ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:133:5: error: unknown type name 'DWORD'
    DWORD                         dwAccess;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:134:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                       name;
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:154:142: error: unknown type name 'HANDLE'
  ...device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
                                                                          ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:164:5: error: unknown type name 'HANDLE'
    HANDLE*                                     pHandle);
    ^
C:\VulkanSDK.3.239.0/Include\vulkan/vulkan_win32.h:177:5: error: unknown type name 'HANDLE'
    HANDLE                               handle;
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Error:1

this is what is shown if I run vulkaninfo:

WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_api_dump.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_gfxreconstruct.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_khronos_synchronization2.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_khronos_validation.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_screenshot.json invalid layer manifest file version 1.2.0.  May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK.3.239.0\Bin\VkLayer_khronos_profiles.json invalid layer manifest file version 1.2.1.  May cause errors.

this is my Vulkan config:

Vulkan Instance Version: 1.2.162


Instance Extensions: count = 11
===============================
        VK_EXT_debug_report                    : extension revision 9
        VK_EXT_debug_utils                     : extension revision 2
        VK_EXT_swapchain_colorspace            : extension revision 4
        VK_KHR_device_group_creation           : extension revision 1
        VK_KHR_external_fence_capabilities     : extension revision 1
        VK_KHR_external_memory_capabilities    : extension revision 1
        VK_KHR_external_semaphore_capabilities : extension revision 1
        VK_KHR_get_physical_device_properties2 : extension revision 2
        VK_KHR_get_surface_capabilities2       : extension revision 1
        VK_KHR_surface                         : extension revision 25
        VK_KHR_win32_surface                   : extension revision 6

I've tried to follow this (https://stackoverflow.com/questions/68215270/how-to-make-vk-layer-khronos-validation-available) but Windows doesn't let me delete the register

I installed the latest Vulkan SDK so it doesn't seem to be the problem. Can someone help me?

答案1

得分: 0

这些错误与查找 vulkan_win32.h 无关。它们与其内容有关,这就是为什么编译器能告诉你这些错误发生在这个文件中。

Khronos 决定让应用程序开发者负责在每个 vulkan_platform_name.h#include 特定于平台的头文件。
对于所有这些文件,包括 vulkan_win32.h 在内,都是如此。

相反,你可以 #include <vulkan/vulkan.h>,它会根据你选择的 VK_USE_PLATFORM_XXXXXX 来选择正确的平台和特定于平台的头文件进行 #include

英文:

These error have nothing to do with finding vulkan_win32.h. They are related to its contents, which is why the compiler is able to tell you the errors occur in this file.

Khronos decided to let the application developer the responsibility to #include platform-specific headers in each vulkan_platform_name.h.
This is true for all of them, including vulkan_win32.h.

You can instead #include <vulkan/vulkan.h>, which selects the correct platform and platform-specific headers to #include, based on the VK_USE_PLATFORM_XXXXXX you selected.

huangapple
  • 本文由 发表于 2023年2月13日 23:49:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438182.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定