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

deprecated functions in io.h #264

Open
offthebus opened this issue Nov 17, 2022 · 3 comments
Open

deprecated functions in io.h #264

offthebus opened this issue Nov 17, 2022 · 3 comments

Comments

@offthebus
Copy link

io.h uses sprintf. VS2019 gives deprecated warnings as errors so the project will not build. I changed io.h to use sprintf_s which resolves the issue. I am not a github user really so I don't want to try committing this change. Thank you for this library, I am looking forward to trying it out.

@Jesse2431
Copy link

Could you tell how you did that? I'm getting 3 errors when changing all sprintf to sprintf_s in io.h.
C2440 'function': cannot convert from 'float' to 'const char *const' Line 82
C2440 'function': cannot convert from 'float' to 'const char *const' Line 125
C2440 'function': cannot convert from 'float' to 'const char *const' Line 167

@recp
Copy link
Owner

recp commented Nov 19, 2022

Hi, @offthebus, @Jesse2431

#define _CRT_SECURE_NO_WARNINGS should suppress those warnings. It is defined in cglm/common.h:
https://github.com/recp/cglm/blob/master/include/cglm/common.h#L15-L17

Do you use latest version of cglm ?

@sacereda
Copy link

@recpt @offthebus

I'm having the same behaviour here. I have isolated it with this .c file:

test.c

#include <sys/types.h>
#include <cglm/cglm.h>

If you compile it with:

cl /c /Icglm/include test.c /MDd /W3

You 'll see the sprintf warnings.

I think the problem is this sys/types.h ends up including vcruntime.h, which is where the _CRT_INSECURE_DEPRECATE macro is defined, and your definition from common.h comes later in this case.

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

No branches or pull requests

4 participants