本文链接:https://www.jianshu.com/p/6ea100865744

环境

系统:Windows7 SP1 64位

编辑器:Visual Studio Community 2017

Live555:2018-01-24

准备工作

下载源码

http://www.live555.com/liveMedia/public/

下载live555-latest.tar.gz,我的是2018-01-24版本

下载VS

https://www.visualstudio.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&rel=15

安装VS

安装时选上“使用C+ +的桌面开发”。已经安装过VS但是没有C+ +组件的,在开始-程序和功能中找到Visual Studio Community 2017,选择修改,选上“使用C+ +的桌面开发”。

新建项目

新建live555项目,选择Windows控制台应用程序

把解压出来的live目录下的BasicUsageEnvironment、GroupSock、LiveMedia、UsageEnvironment、MediaServer目录复制到工程目录下

选文件-添加-新建项目,名称是BasicUsageEnvironment

设置项目属性为静态库

设置不使用预编译头

把c和cpp文件添加进源文件目录,h和hh文件添加进头文件目录

用同样的方法新建项目GroupSock、LiveMedia、UsageEnvironment

新建项目MediaServer,添加源文件和头文件

设置附加包含目录

添加include目录

编译运行

按F5开始调试

复制视频文件到Debug目录

打开VLC,按Ctrl+N,输入URL

开始播放

结束。

附上一些报错

生成BasicUsageEnvironment报错:

错误	C4996	'_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.	BasicUsageEnvironment	d:\code\vs\live555\basicusageenvironment\basicusageenvironment0.cpp	78

解:把snprintf改成_snprintf_s

参考 http://blog.csdn.net/ztf312/article/details/77183360

另一种方法:可能会出现‘_snprintf’错误,解决此错误的方法是在选择项目->属性->配置属性->C/C++->预处理器->预处理器定义,添加如下信息:_CRT_SECURE_NO_DEPRECATE

编译报错:

错误	C4996	'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings	GroupSock	d:\code\vs\live555\groupsock\netaddress.cpp	108

解:

Project properties -> Configuration Properties -> C/C++ -> General -> SDL checks -> No

参考:

https://jingyan.baidu.com/article/1709ad8097e5904634c4f03e.html

编译报错:

错误	C1083	无法打开预编译头文件: “Debug\MediaServer.pch”: No such file or directory	MediaServer	d:\code\vs\live555\mediaserver\stdafx.cpp	5

解:

Right-click on your project in the Solution Explorer.
Click Properties at the bottom of the drop-down menu.
At the top left of the Properties Pages, select All Configurations from the drop-down menu.
Open the C/C++ tree and select Precompiled Headers
Precompiled Header: Select Use (/Yu)
Fill in the Precompiled Header File field. Standard is stdafx.h
Click Okay
If you do not have stdafx.h in your Header Files put it there. Edit it to #include all the headers you want precompiled.
Put a file named stdafx.cpp into your project. Put #include "stdafx.h" at the top of it, and nothing else.
Right-click on stdafx.cpp in Solution Explorer. Select Properties and All configurations again as in step 4 ...
... but this time select Precompiled Header Create (/Yc). This will only bind to the one file stdafx.cpp.
Put #include "stdafx.h" at the very top of all your source files.
Lucky 13. Cross your fingers and hit Build.

参考 https://stackoverflow.com/questions/6096384/how-to-fix-pch-file-missing-on-build

编译报错:

fatal error C1010: 在查找预编译头时遇到意外的文件结尾

解决方式:

一.
1) 在解决方案资源管理器中,右击相应的.cpp文件,点击“属性”
2) 在左侧配置属性中,点开“C/C++”,单击“预编译头”
3) 更改右侧第一行的“创建/使用预编译头”,把选项从“使用预编译头(/Yu)”改成“不使用预编译头”
4) 注:每一个报错的.cpp都要如此更改哦~辛苦一下呗~
二.
(不推荐)
1)在解决方案右击工程,点击属性
2)在配置属性 -> c/c++ -> 预编译头 中 将 “使用预编译头(/YU)” 改为 “不适用预编译头”
这种做法会使每次编译过程非常缓慢

参考 http://blog.sina.com.cn/s/blog_58649eb30100th2k.html

参考

http://blog.csdn.net/yzhang6_10/article/details/51170151

http://blog.csdn.net/hjl240/article/details/48159243

最新文章

  1. C和指针 第十六章 标准函数库
  2. 学习Linux系列--布署常用服务
  3. 快速击键(MyEclipse编写的QuickHit项目)
  4. nios II--实验7——数码管IP硬件部分
  5. 第十五章 调试及安全性(In .net4.5) 之 管理程序集
  6. 【STL学习】map&set
  7. 学DSP(一):开始
  8. 常用的Linux操作命令(一)
  9. Hibernate在自由状态和持久的状态转变
  10. 机器学习基石 2 Learning to Answer Yes/No
  11. 201521123068 《java程序设计》 第13周学习总结
  12. JAVA本地环境启动OOM问题排查
  13. gerrit和git
  14. 移动端、PC端(前后台)、小程序常用的UI框架
  15. 使用注释来解决关于inline-block元素换行问题
  16. sqler sql 转rest api 的工具试用
  17. 前后台联调,突然所有的接口请求状态为200,但response什么都没有只有一句灰色的英文
  18. go语言中的方法method
  19. 根据js来判断手机是操作系安卓还是ios
  20. python 几种方法实现随机生成8位同时包含数字、大写字符、小写字符密码的小程序

热门文章

  1. BurpSuite安装和配置
  2. 引入jQuery
  3. ubuntu 安装 zend studio
  4. [javascript]两段 javaScript 代码的逻辑比较
  5. mysql初次登陆跳过密码并初始化密码
  6. D3.js的基础部分之数组的处理 映射(v3版本)
  7. TSQL--聚合函数
  8. Mathout In Action(中文)
  9. ie11下ajax用escape发送中文参数失败
  10. 在相应目录下新建或读取xml文件