vulkan-guide
vulkan-guide copied to clipboard
Compile Error in vk_mem_alloc.h with VS2019
I downloaded the all-chapters branch configured the project with CMake for VS2019 and then set chapter 3 as startup project. When trying to compile I get a bunch of errors in vk_mem_alloc.h

From monkeying about with the code, I seems to be due to some incompatibility between SDL and VMA. If you move the VMA include in vk_engine.cpp to be above the SDL include, it works.
Works
#define VMA_IMPLEMENTATION
#include "vk_mem_alloc.h"
#include <SDL.h>
#include <SDL_vulkan.h>
Fails with the errors above.
#include <SDL.h>
#include <SDL_vulkan.h>
#define VMA_IMPLEMENTATION
#include "vk_mem_alloc.h"
I'd need to investigate it more as to why its causing that, but at least this fix should allow you to continue working with the tutorial.
Thank you so much.
The same issue, looking forward to seeing why.
I thought the problem is about the std::shared_mutex in VMA by a glance of the error msg, then add set(CMAKE_CXX_STANDARD 17) in CMakeList to force MSVC use 17 standard for compiling, and it works well. But it really confused me by way of swapping vma header with sdl...
Thanks for posting - this fixed it for me