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

error C4996: 'strncpy' unsafe #122

Closed
incendor opened this issue Nov 13, 2017 · 8 comments
Closed

error C4996: 'strncpy' unsafe #122

incendor opened this issue Nov 13, 2017 · 8 comments
Labels

Comments

@incendor
Copy link

Hi!

Today I generated a glad.c file and includes for C++ and OpenGL 4.4 using your webservice.

When I tried to include it in my C++ Project (#include as well as adding the glad.c file to my project) and building that, I got the following two errors:

e:\files\opengl\glad.c(173): error C4996: '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.

c:\program files (x86)\windows kits\10\include\10.0.16299.0\ucrt\string.h(343): note: see declaration of 'strncpy'

I tried reinstalling this exact windows kit but that didn't help.

Is there any way I can solve this problem? Or did i make a mistake when generating the files / integrating them into my project?

~ Incendor

@Dav1dde
Copy link
Owner

Dav1dde commented Nov 13, 2017

Thanks for bringing that up, that's a thing I should fix asap.

@Dav1dde Dav1dde added the bug label Nov 13, 2017
@incendor
Copy link
Author

Since I don't want to rush you to create a fixed release, is there a simple way I can fix the generated glad.c file myself?

@Max-ChenFei
Copy link

I also meet this bug,

@Dav1dde
Copy link
Owner

Dav1dde commented Nov 14, 2017

Workaround is defining:

#define _CRT_SECURE_NO_WARNINGS

before including glad. I will release an updated version within a few hours.

@incendor
Copy link
Author

Cool, thank you very much! I'll try later today. Sorry if asking for a workaround seemed stupid, I'm super new to C++ and just following a tutorial on OpenGL right now. Thank you for your amazing generator, quick support and help! :)

~ Incendor

@Dav1dde
Copy link
Owner

Dav1dde commented Nov 14, 2017

Should be fixed in master, can you confirm that for me?

Try generating glad from here: http://cglad.dav1d.de/ (note that is not yet live and a different subdomain).

Thanks!

@incendor
Copy link
Author

Worked great! :)

Now I'm getting a LINK error but I don't think that has to do with glad.

@Dav1dde
Copy link
Owner

Dav1dde commented Nov 14, 2017

Thanks again, I finally managed to setup a project in VC++ - works also on my end :)

Changes pushed to the main website - Will push a new version after fixing the (void) bug in #119.

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

No branches or pull requests

3 participants