我是osx的新手,遇到了一些问题。我尝试制作makefile但提出了: error: unknown type name 'u_char'; did you mean 'char'?
我提到 C PCAP库未知类型错误,将-D_BSD_SOURCE
CFLAGS添加到我的makefile中,但没有帮助。我缺少什么?
编辑:
这是产生错误的代码:
char *computePwd(const u_char *md5) {
static char buf[16];
unsigned char tmp[40];
int tmpl=0;
tmpl = strlen(userName);
strcpy((char*)tmp, userName);
memcpy(tmp + tmpl, md5, 16);
tmpl += 16;
memcpy(buf, ComputeHash(tmp, tmpl), 16);
memset(tmp, 0, 16);
strcpy((char*)tmp, password);
int i;
for (i=0; i<16; ++i)
buf[i] ^= tmp[i];
return buf;
}
添加-Du_char="unsigned char"
到CFLAGS
或刚修好的来源。使用u_char
懒惰简写unsigned char
为在遗留BSD代码库一种常见的做法,其中系统头历史暴露这样一个typedef。它不应在现代代码中使用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句