4
我正在使用mingw-w64。我包括strsafe.h
并得到以下警告:如何摆脱“内联函数使用但从未定义”警告g ++
warning: inline function 'HRESULT StringCchPrintfA(STRSAFE_LPSTR, size_t, STRS
AFE_LPCSTR, ...)' used but never defined [enabled by default]
的唯一标志标志-Wall -DDEBUG -g
。我知道你必须在同一个头文件中定义内联函数,我查看了strsafe.h
,我清楚地看到头文件中有StringCchPrintfA
,所以我不知道为什么它给了我这个错误。另外,这里是a link to strsafe.h if you want to look at the header yourself。
编辑:
我发现下面的代码片段在网上(如果有人能提供更多的信息,请让我知道,什么是试图在注释说?):
// 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
是否有可能__CRT__NO_INLINE定义在某处,因此该函数并未实际定义? – tpg2114 2011-12-14 23:36:30
@ tpg2114如果定义了___CRT__NO_INLINE,那么`StringCchPrintfA`不会是内联函数。 – 2011-12-14 23:38:50