Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC preprocessor errors, MSVC doesn't define WIN32, only affecting versions <1.3.275 #2046

Open
fl2mex opened this issue Jan 15, 2025 · 1 comment

Comments

@fl2mex
Copy link

fl2mex commented Jan 15, 2025

When using versions above 1.3.275, vulkan_structs.hpp checks for WIN32 define, which MSVC doesn't provide, making certain functions call strncpy instead of strncpy_s, which is used in versions 1.3.275 and below. Only encountered this issue when I upgraded to 1.3.296.

Giving this error:

'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

An easy/temporary fix is to do this in every place that vulkan.hpp is included, which a bunch of people told me was the best option:

#define _CRT_SECURE_NO_WARNINGS
#include <vulkan/vulkan.hpp>
#undef _CRT_SECURE_NO_WARNINGS

This solution isn't the best though. MSVC provides _WIN32 and _WIN64, but are mutually exclusive when compiling.
One way to fix this is to perform an or operation on the WIN32 preprocessor, before any checks.

@fl2mex
Copy link
Author

fl2mex commented Jan 16, 2025

Forgot to mention, this also happens on 1.4.304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant