How to get rid of the "built-in function used but never defined" in g ++

I am using mingw-w64. I turn on strsafe.h and get the following warning:

 warning: inline function 'HRESULT StringCchPrintfA(STRSAFE_LPSTR, size_t, STRS AFE_LPCSTR, ...)' used but never defined [enabled by default] 

The only flag flags I used are -Wall -DDEBUG -g . I know that you need to define inline functions in one header, and I looked at strsafe.h and I clearly see that StringCchPrintfA in the header, so I don’t know why it gave me this error. In addition, here is a link to strsafe.h if you want to see the title yourself .

Edit:

I found the following snippet on the Internet (if anyone can provide further information, please let me know what you are trying to say in the comment?):

 // Work around lack of strsafe library in mingw-w64, do let their // strsafe.h provide inlines of StringCchVPrintfA etc, avoid linking // errors in a debug build. #ifdef __CRT__NO_INLINE #undef __CRT__NO_INLINE #define DID_UNDEFINE__CRT__NO_INLINE #endif extern "C" { #endif #include <strsafe.h> #ifdef __MINGW32__ } #ifdef DID_UNDEFINE__CRT__NO_INLINE #define __CRT__NO_INLINE #endif #endif 
+4
source share
1 answer

The comment indicates that it is supposed to be the strsafe library, but it is missing. The definition of __CRT__NO_INLINE should imply that somewhere there is a compiled library to provide functions instead of using inline'd from the header.

So, in case this library is missing (but it looks like it thinks it should be), allow the use of built-in functions.

But this is a fix for binding errors. Do you have errors compiling your code? Or are you just getting a warning? If you get a warning, then you have the strsafe library. It is very likely that there is no way to eliminate the message and still use the compiled version of the function.

+1
source

Source: https://habr.com/ru/post/1386428/


All Articles