Closed thesmallcreeper closed 6 years ago
Thanks for the info! Maybe I will try to change the repository so the problem does not occur with VS2017.
Hi. I'd like to have a better understanding what You are trying to achieve. Does this problem occur while compiling samples from the Cookbook or Your own?
In Cookbook samples VulkanFunctions.h
file is included in two places. So if You are creating Your own project, but use files from the Cookbook and if You define VK_USE_PLATFORM_WIN32_KHR
just before the one of these inclusions but not before the other, this may generate compilation errors (depending on the order of compiled files).
That's why in Vulkan Cookbook samples, this definition is specified not in code but globally through project properties:
Project -> Properties -> C++ -> Preprocessor -> Preprocessor Definitions
If You are compiling Your own project try adding VK_USE_PLATFORM_WIN32_KHR
in the above option. This should help.
But if the problem concerns compilation of Vulkan Cookbook samples with VS2017, then I will need to have a look at it when I finally install this version of Visual Studio.
On something on my own.
Thinking twice about this issue I think it was unnecessary. I could not get why defining VK_USE_PLATFORM_WIN32_KHR on such a way could not work.
Thank you for your time and sorry if you feel like I wasted some of it.
I'm not sure that I helped here but an open conversation is always good ;-). If You have any other problems, do not hesitate to write.
If on main.cpp I include and define with this order:
and VulkanFunctions.h is like this:
and on my ListOfVulkanFunctions.inl there is a platform specific function from extension , example:
INSTANCE_LEVEL_VULKAN_FUNCTION_FROM_EXTENSION(vkCreateWin32SurfaceKHR, VK_KHR_WIN32_SURFACE_EXTENSION_NAME)
Then on compiling I get syntax errors (errors: C4430 , C2146) on the lines of ListOfVulkanFunctions.inl that platform specific functions exist. By the way, manually using vkGetInstanceProcAddr works.
However!, if I write
#define VK_USE_PLATFORM_WIN32_KHR
just above#include "vulkan/vulkan.h"
onVulkanFunctions.h
everything compile (and work) fine!I just write this because I find it strange that this happen since in main.cpp I already define
#define VK_USE_PLATFORM_WIN32_KHR
and then include#include "VulkanFunctions.h"
, but I have to redefine the platform again at VulkanFunctions.h.Is there a explanation? Even though I have a poor experience of #define(s) and #include(s) this look strange to me and so I make this "issue"
Using Visual Studio 2017 (15.6.4). SDK: 10.0.16299.0 Platform Toolset: Visual Studio 2017 (v141)
P.S: Might be a better place to share this piece of information since this is not a issue-bug of your code.