Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu下编译出现 "u_char" 未定义的问题 #269

Open
weiguang opened this issue Mar 10, 2016 · 6 comments
Open

ubuntu下编译出现 "u_char" 未定义的问题 #269

weiguang opened this issue Mar 10, 2016 · 6 comments

Comments

@weiguang
Copy link

我下载了源码编译之后出现了u_char" 未定义。我编译googlecode的源码可以编译成功。

ubuntu 编译:
sh autogen.sh
./configure --prefix=/usr
make CFLAGS+=-std=c99

结果:unknown type name ‘u_char’
make[2]: Entering directory '/home/jam/mentohust/src'
CC myconfig.o
In file included from myconfig.c:20:0:
myfunc.h:20:26: error: unknown type name ‘u_char’
void fillMd5Packet(const u_char md5Seed); / 填充Md5包 /
^
myfunc.h:21:21: error: unknown type name ‘u_char’
void fillEchoPacket(u_char *buf); /
填充Echo包 /
^
myfunc.h:22:23: error: unknown type name ‘u_char’
void getEchoKey(const u_char *capBuf); /
获取EchoKey /
^
myfunc.h:23:1: error: unknown type name ‘u_char’
u_char *checkPass(u_char id, const u_char *md5Seed, int seedLen); /
计算密码的md5 /
^
myfunc.h:23:19: error: unknown type name ‘u_char’
u_char *checkPass(u_char id, const u_char *md5Seed, int seedLen); /
计算密码的md5 /
^
myfunc.h:23:36: error: unknown type name ‘u_char’
u_char *checkPass(u_char id, const u_char *md5Seed, int seedLen); /
计算密码的md5 /
^
myfunc.h:24:21: error: unknown type name ‘u_char’
void fillCernetAddr(u_char *buf); /
填充赛尔网络地址 /
^
myconfig.c:60:8: error: unknown type name ‘u_char’
extern u_char version[]; /
版本 /
^
myconfig.c:72:1: error: unknown type name ‘u_char’
u_char localMAC[6]; /
本机MAC /
^
myconfig.c:73:1: error: unknown type name ‘u_char’
u_char destMAC[6]; /
服务器MAC /
^
myconfig.c: In function ‘initConfig’:
myconfig.c:261:5: error: ‘u_char’ undeclared (first use in this function)
((u_char *)&gateway)[3] = 0x02;
^
myconfig.c:261:5: note: each undeclared identifier is reported only once for each function it appears in
myconfig.c:261:13: error: expected expression before ‘)’ token
((u_char *)&gateway)[3] = 0x02;
^
myconfig.c: In function ‘checkRunning’:
myconfig.c:625:4: warning: implicit declaration of function ‘kill’ [-Wimplicit-function-declaration]
if (kill(fl.l_pid, SIGINT) == -1)
^
myconfig.c:639:3: warning: implicit declaration of function ‘daemon’ [-Wimplicit-function-declaration]
if (daemon(0, (daemonMode+1)%2))
^
Makefile:420: recipe for target 'myconfig.o' failed
make[2]: *
* [myconfig.o] Error 1

@weiguang weiguang changed the title u ubuntu下编译出现 "u_char" 未定义的问题 Mar 10, 2016
@weiguang
Copy link
Author

我认为是加了c99编译的原因。因为我在编译0.3.1算法的时候加入 c99编译也是出现这个问题。
在网上找到了错误。但是不知道怎么改呢、、
http://stackoverflow.com/questions/15466342/why-uint-from-sys-types-h-disappears-using-std-c99/15466411#15466411

@updateing
Copy link
Contributor

如果单纯为了编译的话,可以typedef unsigned char u_char;来解决。

这里对于u_char的解释更确切一些: http://stackoverflow.com/questions/1918934/is-u-char-a-standard

@hyrathb
Copy link
Owner

hyrathb commented Mar 13, 2016

嗯,我是不会考虑用这些类型的,希望谁有时间能重构一下代码,毕竟老代码和新代码质量都不高……

@weiguang
Copy link
Author

我已经把c99那个for循环修改了一下。可以编译了。我是华南农业大学的, 学校增加了接入方式,以区分办公账号和学生账号。以前的代码不支持办公账号,我抓包看了协议,start包后面增加了字段。所以我修改代码增加了一个参数S,现在可以支持了。我可以把代码整合上去吗?

@hyrathb
Copy link
Owner

hyrathb commented Mar 14, 2016

你可以开一个pull request,多谢,能支持更多当然更好。

@hyrathb
Copy link
Owner

hyrathb commented Mar 14, 2016

之前一直忘记改掉那个循环了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants