CTorrent在Ubuntu下编译错误解决

1、invalid conversion from ‘const char*’ to ‘char*’

解决:

pn = strchr(p, PATH_SP);

改为

pn = (char *)strchr(p, PATH_SP);

2、 ‘PACKAGE_STRING’ was not declared in this scope

‘PACKAGE_BUGREPORT’ was not declared in this scope

解决:

fprintf(stderr,"%s Copyright: YuHong(992126018601033)",PACKAGE_STRING);

fprintf(stderr,"bug report: %s\n\n",PACKAGE_BUGREPORT);

替换为:

fprintf(stderr,"CTorrent devel Copyright: YuHong(992126018601033)");

fprintf(stderr,"bug report: @www.linuxidc.com\n\n");

3、fatal error: openssl/sha.h: 没有那个文件或目录

缺少 openssl dev包,解决:安装libssl-dev

sudo apt-get install libssl-dev

4、undefined reference to `SHA1_Init'

undefined reference to `SHA1_Update'

undefined reference to `SHA1_Final'

解决1:

1.确认你装了openssl

2.g++ 后加上参数 -lssl

解决2:

或者/usr/lib/libssl.so加入程序library库下

Eclipse CDT下设置g++参数的方法

Project->Properties->C/C++ Build->Setting->GCC C++ Linker->Miscellaneous->Linker Flag 处加上 -lssl

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23937.html