从windows移植到linux碰到的问题
环境: LINUX 企业版5.0
boost_1.40, zlib_1.53, lua_1.5
工具: codelite
如何编译boost, zlib, lua:
编译boost:
1. 进入boost_1_40_0文件夹
2. ./bootstrap.sh
3. ./bjam install
就这3步就装好boost了
编译lua:
make
make generic
make install
编译zlib:
./configure
make
make install
设置工程要引用的libs,include
环境达好了就是改代码了
1.在windows下面经常引用文件如 #include "xxx\ ttt.h",这个在linux下是不行的
要改成#include "xxx/ ttt.h",
2.strcpy在linux下面最好用strncpy替代, sscanf_s直接用sscanf替代好了
3.如果用到了hashmap,那就有点恶心了
我是单起了一个文件处理:
#ifndef _UTILIY_HASHMAP_H_
#define _UTILIY_HASHMAP_H_
#ifdef __WINDOWS
#include <hash_map>
#define hashmap stdext::hash_map
#else
#include <ext/hash_map>
#include <string>
#include "utility_fixstring.h"
struct lua_State;
namespace __gnu_cxx
{
template<> struct hash<std::string>
{
size_t operator()(const std::string & x) const
{
return hash<const char*>()(x.c_str());
}
};
template<unsigned int sz> struct hash<qin::fix_string<sz> >
{
size_t operator()(const qin::fix_string<sz> & x) const
{
return hash<const char*>()(x.c_str());
}
};
template<> struct hash<lua_State*>
{
size_t operator()(const lua_State* const& key) const
{
return ((size_t)(void*)(unsigned long)key) >> 4;
}
};
}
using namespace __gnu_cxx;
#define hashmap __gnu_cxx::hash_map
#endif
#endif
TMD,在linux下面你自己定义的结构体类型做key的时候,都要重写hash函数的,结构体指针就要转换成整型值判断
对编译库文件,生成文件名字前要加lib,比如设置库输出路径的时候lib$ProjectName.a
如何引用库:
先设置要要引用的路径,然后把对应库的.0文件从/usr/local/lib考到/usr/lib下
未完,先吃饭
相关文档:
总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
2009 年 4 月 23 日
本文中我们针对 Linux 上多线程编程的主要特性总结出 5 条经验,用以改善 Linux 多线程编程的习惯和避免其中的开发陷阱。在本文中,我们穿插一些 Windows 的编程用例用以对比 Linux 特性,以加深读者印象。
背景
Linux 平台上的多线程程序开发相对应其他平台(比如 Windows)的多线程 API 有一些细微 ......
头文件:sys/socket.h
相关结构体:
struct sockaddr
{
unsigned short sa_family; //地址族
char sa_data[14]; //14字节协议地址
};
struct sockaddr_in
{
short int sin_family; //地址族
u ......
author:skate
time:2010-05-24
以前也用过linux的远程图形界面管理程序x-win32,地址如下:
http://blog.csdn.net/wyzxg/archive/2007/09/10/1779148.aspx
今天介绍在介绍一个图形管理软件vnc,简单配置如下
vnc服务端os版本:centos4.7
vnc client: nvc viewer客户端
1.检查vnc服务器是否安装
[root@ ......