I'm attempting to write a simple vulkan based application, but when trying to add the surface extension to the list of enabled extensions, like so:
enabledExtensions.push_back( VK_KHR_SURFACE_EXTENSION_NAME );
#if defined (_WIN32)
enabledExtensions.push_back( VK_KHR_WIN32_SURFACE_EXTENSION_NAME );
#else
enabledExtensions.push_back( VK_KHR_XCB_SURFACE_EXTENSION_NAME );
#endif
Visual studio complains that VK_KHR_WIN32_SURFACE_EXTENSION_NAME
is undefined.
When I right click it and go to definition, it opens vulkan.h. Upon inspection of VK_USE_PLATFORM_WIN32_KHR
I find this to be also undefined, which prevents the definition of VK_KHR_WIN32_SURFACE_EXTENSION_NAME
. Could someone explain how to fix this?
As it turns out, I was missing some preprocessor directives in the project settings:
VK_PROTOTYPES
VK_USE_PLATFORM_WIN32_KHR
I hope this info helps out anyone who has the same problem.
This seems to be a common problem, currently you can fix this by adding the specific header
#if defined (_WIN32)
#include <vulkan/vulkan_win32.h>
#elif defined(__linux__)
#include <vulkan/vulkan_xcb.h>
#elif defined(__ANDROID__)
#include <vulkan/vulkan_android.h>
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With