From: William S F. <ws...@fu...> - 2013-01-31 19:21:28
|
On 31/01/13 18:46, Olivier Voyer wrote: > Hi everyone, > > I'm using SWIG in Visual Studio 2010 with C++ and when I compile the > .cpp generated by SWIG I receive a bunch of warnings concerning > deprecated functions (such as strcpy and strncpy). Is there a way to > correct that in SWIG, other than to ignore those warnings in my project? > Normally I try to avoid the #pragma command as much as possible, but I > know #pragma warning(disable : 4996) would do the trick. > > 2>SWIG\swig_application_wrap.cpp(692): warning 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. > 2> C:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\include\string.h(105) : see declaration of 'strcpy' > 2>SWIG\swig_application_wrap.cpp(717): warning 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. > 2> C:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\include\string.h(188) : see declaration of 'strncpy' > They may indeed by unsafe, but they are not deprecated despite what the compiler is saying. You should not see these warnings too as by default SWIG does define _CRT_SECURE_NO_WARNINGS unless SWIG_NO_CRT_SECURE_NO_DEPRECATE is defined. This approach could be tweaked given the new C11 macro __STDC_WANT_LIB_EXT1__. Did you define the SWIG_NO_CRT_SECURE_NO_DEPRECATE macro? If not, then something has gone wrong. Which language module are you using? William |