天天看点

rtmpdump移植到 Windows VS2008 下的移植日志

1. 创建win32控制台应用程序,将librtmp下的文件分成"头文件"和"源文件",分别放置.

2. 将rtmpsrv.c, rtmpsuck.c, rtmpgw.c从项目中移除. 这些功能是暂时不用的。

3. 编译提示: " fatal error C1083: 无法打开包括文件:“stdint.h”: No such file or directory". 解决: 从linux下的系统文件"stdint.h"复制到librtmp文件夹下; 在项目中添加"现有项"; 将所有提示的地方改成#include "stdint.h"。

4. 编译提示: " fatal error C1083: 无法打开包括文件:“getopt.h”: No such file or directory ". 解决: 将linux下的文件"getopt.c", "getopt.h"复制到rtmpdump目录下; 将文件添加到现有项目; 将#include<stdin.h>改成#include"stdin.h";

5. 错误提示: fatal error C1083: 无法打开包括文件:“openssl/ssl.h”: No such file or directory  解决: 在项目属性页->C/C++->预处理器->预处理器定义中添加"NO_CRYPTO" 这样做就是不用RTMPT, RTMPE等协议。

6. error C2081: “off_t”: 形参表中的名称非法 解决: 将zlib下的文件zlib.h zconf.h复制到rtmpdump目录下;

7. 错误提示: 1>rtmpdump.obj : error LNK2019: 无法解析的外部符号 [email protected],该符号在函数 _InitSockets 中被引用 1>rtmpdump.obj : error LNK2019: 无法解析的外部符号 [email protected],该符号在函数 _CleanupSockets 中被引用 解决: 见链接:http://hi.baidu.com/net_speed_slow/item/771647ca5bfe843099b4985e

在头文件中加入语句#pragma comment( lib, "ws2_32.lib" )   来显式加载。 即: #include <winsock2.h>  #pragma comment(lib, "WS2_32")

8. 错误提示: 1>rtmpdump.obj : error LNK2019: 无法解析的外部符号 _fseeko64,该符号在函数 _OpenResumeFile 中被引用 1>rtmpdump.obj : error LNK2019: 无法解析的外部符号 _ftello64,该符号在函数 _OpenResumeFile 中被引用

解决: 将定义改成: #define fseeko fseek #define ftello ftell

9. 错误提示: 1>rtmpdump.obj : error LNK2019: 无法解析的外部符号 _snprintf,该符号在函数 _main 中被引用

解决: 将snprintf改成"_snprintf" strncasecmp改成"strncmp" strcasecmp改成"strcmp"

11. 将所有的在代码中的变量定义改到函数开始处,或是本层{}的开始处, 这是因为VC默认是不支持变量定义随处定义的。

12. 错误提示: warning C4996: 'setmode': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _setmode. See online help for details. 解决: 将"setmode"改成"_setmode" 将"fileno"改成"_fileno"

编译通过,测试通过

继续阅读