POCO库 安装
2016-06-22 15:46
399 查看
安装环境:
CentOS7、阿里云
1、文档
官网:http://pocoproject.org/documentation/
2、下载到服务器
wget
3、使用yum安装ODBC、mysql
注意,最好不要自定义安装位置,报http错误
4、安装POCO
我自定义了安装位置,但是最好不要这样。
5、在安装过程中会报错
可以用locate libXXX的命令来查询相应库的安装位置,不过我都安装了也会报错,应该是版本太低了。
locate命令有时会报错,updatedb就可以。
可以用yum search XXX查找yum可以安装的库。
然后使用yum安装
总之是缺少什么库就安装什么库。。
6、写个demo测试
网上随便找的。。注意头文件使用poco最好使用<>
7、设置系统变量
由于我是自定义安装位置,编译的时候找不到头文件的位置,我是修改了系统的环境变量
在目录 /etc/profile.d 中随便加一个 .sh 文件 ,例如我的 my.sh
或者:
8、编译demo
如果安装poco时选择的是系统默认的路径就很简单、如果自定义了安装路径需要在编译的时候指定动态链接库的路径
我的安装路径是:/customServes/poco/install
编译指令就是: g++ temp.cpp -o t -L/customServes/poco/install/lib/ -lPocoNet
9、总结
出了问题最好google,百度没多大用。。。
CentOS7、阿里云
1、文档
官网:http://pocoproject.org/documentation/
2、下载到服务器
wget
3、使用yum安装ODBC、mysql
# yum -y install unixODBC # yum -y install unixODBC-devel # yum -y install mysql # yum -y install mysql-devel
注意,最好不要自定义安装位置,报http错误
4、安装POCO
# gunzip poco-X.Y.tar.gz # tar -xf poco-X.Y.tar # cd poco-X.Y # ./configure # gmake -s install
我自定义了安装位置,但是最好不要这样。
./configure --prefix=/customServes/poco/install --cflags=-fPIC --static --shared
5、在安装过程中会报错
/usr/bin/ld: cannot find -lpthread /usr/bin/ld: cannot find -ldl /usr/bin/ld: cannot find -lrt /usr/bin/ld: cannot find -lstdc++ /usr/bin/ld: cannot find -lm /usr/bin/ld: cannot find -lc
可以用locate libXXX的命令来查询相应库的安装位置,不过我都安装了也会报错,应该是版本太低了。
locate命令有时会报错,updatedb就可以。
可以用yum search XXX查找yum可以安装的库。
yum search pthread yum search libc yum search stdc++
然后使用yum安装
yum install glibc-common yum install glibc-devel yum install glibc-static yum install libstdc++-static
总之是缺少什么库就安装什么库。。
6、写个demo测试
网上随便找的。。注意头文件使用poco最好使用<>
#include <Poco/Net/ServerSocket.h> #include <Poco/Net/SocketStream.h> #include <Poco/Net/StreamSocket.h> #include <iostream> int main(int argc, char **argv) { //绑定端口,并开始监听: Poco::Net::ServerSocket srv(9000); //服务主循环: while (true) { //接受连接: Poco::Net::StreamSocket streamSocket = srv.acceptConnection(); //向 Socket 发送数据: Poco::Net::SocketStream socketStream(streamSocket); socketStream << "HTTP/1.0 200 OK\r\n" << "Content-Type: text/html\r\n" << "\r\n" << "<html><head><title>My 1st Web Server</title></head></html>" << std::flush; } return 0; }
7、设置系统变量
由于我是自定义安装位置,编译的时候找不到头文件的位置,我是修改了系统的环境变量
在目录 /etc/profile.d 中随便加一个 .sh 文件 ,例如我的 my.sh
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/customServes/poco/install/include export CPLUS_INCLUDE_PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/customServes/poco/install/lib export LD_LIBRARY_PATH
或者:
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
8、编译demo
如果安装poco时选择的是系统默认的路径就很简单、如果自定义了安装路径需要在编译的时候指定动态链接库的路径
我的安装路径是:/customServes/poco/install
编译指令就是: g++ temp.cpp -o t -L/customServes/poco/install/lib/ -lPocoNet
9、总结
出了问题最好google,百度没多大用。。。
相关文章推荐
- 小心服务器内存居高不下的元凶--WebAPI服务
- 运维入门
- 利用开源软件打造自己的全功能远程工具
- Linux5.9无人值守安装
- 数据中心和云未来的十二大趋势
- 用vsftp快速搭建ftp服务器
- Linux快速构建apache web服务器
- 服务器监控策略浅谈
- 如何降低服务器采购成本 原理分析
- 建议的服务器分区办法
- 服务器托管六大优势分析
- Erlang实现的一个Web服务器代码实例
- 服务器技术全面解析
- 保护DNS服务器的几点方法小结
- 我国成为全球第二大服务器消费国
- 服务器 安全检查要点[星外提供]
- 服务器应用自动重新启动IIS批处理[原创]_DOS/BAT_脚本之家
- FTP 服务器关于权限的问题
- 批处理设置windows服务器的代码ThecSafe1.9.4第1/3页