Vulkan is a C-style API, which means
enums are implemented in a C-style way, which means “unscoped”. This error means VkResult in Vulkan header files should be declared like this:
enum class VkResult; (scoped enum)
enum VkResult; (unscoped enum)
In modern C++, you should prefer scoped enums over unscoped enums. So this is not an error, it’s a warning. I guess you get an error because you enabled an option in your settings which sees warnings as errors? You can change this in Visual Studio settings:
Configuration Properties -> C/C++ -> General -> Treat Warning As Errors
It’s not your fault because it’s an issue with Vulkan header files. However, Vulkan API is a C-style API and is not written in modern C++ (C++11, C++14, C++17 or C++20…).
You should not worry too much about this warning. The major advantage of using
enum class VkResult would be that “namespace pollution” would be avoided. Another argument is the improved type-safety.
You can read more about this in the official C++ core guidelines:
Or in Scott Meyers book “Effective modern C++”
It’s a book for advanced programmers though.
As a general note, I really recommend to learn modern C++ by reading the C++ core guidelines. They are crafted by a community of world leading C++ experts and really state how C++ should be used. But again, it’s not an issue which comes from the code you wrote.