emilk / loguru

A lightweight C++ logging library
The Unlicense
1.79k stars 260 forks source link

Compiler error regarding unsafe function calls #114

Closed kakyoism closed 5 years ago

kakyoism commented 5 years ago

I got a compiler error when building against loguru:

1>g:\me\loguru.cpp(645): error C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdlib.h(1191): note: see declaration of 'getenv'
1>g:\me\loguru.cpp(673): error C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(266): note: see declaration of 'strncat'
1>g:\me\loguru.cpp(674): error C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(266): note: see declaration of 'strncat'
1>g:\me\loguru.cpp(676): error C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(266): note: see declaration of 'strncat'
1>g:\me\loguru.cpp(723): error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h(208): note: see declaration of 'fopen'
1>g:\me\loguru.cpp(1653): error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\string.h(133): note: see declaration of 'strcpy'

Would you fix this for Windows?

emilk commented 5 years ago

I don't run Windows so am the wrong person to attempt to fix this. It looks like it should be just a small PR though!