1

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\1.3.239.0/Include\vulkan/vulkan_win32.h:30:5: error: unknown type name 'HINSTANCE'      
    HINSTANCE                       hinstance;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:31:5: error: unknown type name 'HWND'
    HWND                            hwnd;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:57:5: error: unknown type name 'HANDLE'
    HANDLE                                handle;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:58:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                               name;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:64:11: error: unknown type name 'SECURITY_ATTRIBUTES'
    const SECURITY_ATTRIBUTES*    pAttributes;
          ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:65:5: error: unknown type name 'DWORD'
    DWORD                         dwAccess;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:66:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                       name;
    ^
C:\VulkanSDK\1.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\1.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\1.3.239.0/Include\vulkan/vulkan_win32.h:89:5: error: unknown type name 'HANDLE'
    HANDLE*                                     pHandle);
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:94:5: error: unknown type name 'HANDLE'
    HANDLE                                      handle,
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:125:5: error: unknown type name 'HANDLE'
    HANDLE                                   handle;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:126:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                                  name;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:132:11: error: unknown type name 'SECURITY_ATTRIBUTES'
    const SECURITY_ATTRIBUTES*    pAttributes;
          ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:133:5: error: unknown type name 'DWORD'
    DWORD                         dwAccess;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:134:5: error: unknown type name 'LPCWSTR'
    LPCWSTR                       name;
    ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:154:142: error: unknown type name 'HANDLE'
  ...device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
                                                                          ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:164:5: error: unknown type name 'HANDLE'
    HANDLE*                                     pHandle);
    ^
C:\VulkanSDK\1.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\1.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\1.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\1.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\1.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\1.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\1.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 (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?

  • [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) Please [edit] your question, copy&paste everything *as text* and format it as code blocks. Add links to the software, not only YouTube links, and show the commands you run to reproduce the error. Did you try to run the registry editor as Administrator? – Bodo Feb 13 '23 at 16:00
  • Yeah, i've tried but it and delete it successfully, then reinstalled Vulkan, but i keep getting the same errors. – Neptune Luke Feb 13 '23 at 16:23
  • 1
    you need to include `` prior to the vulkan header. Those are missing windows types. You should also put `WIN32_LEAN_AND_MEAN` before the `` include to prevent including garbage you don't need. – Mgetz Feb 13 '23 at 16:35
  • Do I have to put in vulkan_win32.h ? If so, why didn't the developer do it? Thx for the reply! – Neptune Luke Feb 13 '23 at 19:30

1 Answers1

0

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.

Erel
  • 512
  • 1
  • 5
  • 14