volk + GLFW = (identifier glfwCreateWindowSurface not found)
TheOrestes opened this issue · 4 comments
First time volk user here. I have been trying to use volk as a header-only library and have followed the steps given to use volk.h instead of vulkan.h wherever required. I have also made sure to have just one file with
#define VOLK_IMPLEMENTATION
#include "Volk/volk.h"
I have also not linking against vulkan-1.lib anymore as mentioned.
However, due to this, I get this "identifier glfwCreateWindowSurface not found" error.
If I include GLFW with #define GLFW_INCLUDE_VULKAN then obviously this function becomes available since vulkan.h from the glfw3.h gets included which prompts "fatal error C1189: #error: To use volk, you need to define VK_NO_PROTOTYPES before including vulkan.h"
Has anyone faced this before, clearly, I am missing out on something obvious!
If I include GLFW with #define GLFW_INCLUDE_VULKAN then obviously this function becomes available since vulkan.h from the glfw3.h gets included which prompts "fatal error C1189: #error: To use volk, you need to define VK_NO_PROTOTYPES before including vulkan.h"
You can follow the suggestion and define VK_NO_PROTOTYPES
, either locally or project wide, include volk.h
before glfw3.h
, or include these in two separate source files. Either approach should work.
I should have mentioned it earlier, but when I try to do that, i get the error LNK2005 for the re-definition of all the vulkan entry-point symbols.
I have created a very basic repro here in case someone wants to take a look. It's very barebone but I have tried to show my usage style. Still pretty sure, it's me who is using it wrong, since when I use it in a single source file, it seems to work.
FYI, I am using the latest vulkan sdk and the volk that comes with it. Thanks a lot.
- I would recommend defining
VK_NO_PROTOTYPES
project wide if you're definingGLFW_INCLUDE_VULKAN
project-wide. I don't actually see the definition ofGLFW_INCLUDE_VULKAN
anywhere but maybe that was removed when making the repro. VOLK_IMPLEMENTATION
must be defined in exactly one source file if you want to use it as a single-source library. As it stands you're defining it inVulkanApplication.h
which is included in two .cpp files, that will cause symbol redefinition conflicts.
"VOLK_IMPLEMENTATION must be defined in exactly one source file" ... I misinterpreted it to be the header file instead of the source. That fixes it. Thank you.