我正在尝试使用 MinGW (GCC 4.8) 在 Windows 上编译 libzqm。编译因以下错误而终止:
'strndup' was not declared in this scope
那么,strndup
应该在 string.h
中,对吧?我尝试将 /mingw/x86_64-w64-mingw32/include
添加到 CXXFLAGS
但没有成功。
有什么建议吗?
最佳答案
尝试添加
#define _GNU_SOURCE
之前
#include <string.h>
strndup
不是标准 C,但如果您使用 GNU libc,那么您可以通过包含上述扩展来获得它。
关于c - 'strndup' 未在此范围内定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17477214/