在调用openssl库时,遇到路径包含问题,于是记录解决的问题如下:
gedit /etc/profile文件,添加如下代码:
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/ssl/include
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/ssl/include
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib
分类目录归档:Linux开发
头文件搜索顺序
头文件搜索顺序:
1.由参数-I指定的路径(指定路径有多个路径时,按指定路径的顺序搜索)
2.然后找gcc的环境变量 C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH
3.再找内定目录
/usr/include
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.2/include
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
库文件,但是如果装gcc的时候,是有给定的prefix的话,那么就是
/usr/include
prefix/include
prefix/xxx-xxx-xxx-gnulibc/include
prefix/lib/gcc-lib/xxxx-xxx-xxx-gnulibc/2.8.1/include
动态库搜索路径先后顺序
动态库的搜索路径搜索的先后顺序是:
1.编译目标代码时指定的动态库搜索路径;
2.环境变量LD_LIBRARY_PATH指定的动态库搜索路径;
3.配置文件/etc/ld.so.conf中指定的动态库搜索路径;
4.默认的动态库搜索路径/lib;
5.默认的动态库搜索路径/usr/lib。
centos5.8下的多个gcc版本切换
1.列出可用的gcc版本:
Yum list gcc
gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, …)
gcc-c++.x86_64 : C++ support for GCC
gcc-gfortran.x86_64 : Fortran 95 support
gcc-gnat.x86_64 : Ada 95 support for GCC
gcc-java.x86_64 : Java support for GCC
gcc-objc++.x86_64 : Objective-C++ support for GCC
gcc-objc.x86_64 : Objective-C support for GCC
gcc44.x86_64 : GNU Compiler Collection version 4.4
gcc44-c++.x86_64 : C++ support for GCC version 4.4
gcc44-gfortran.x86_64 : Fortran support for GCC 4.4
2.安装gcc4.4的版本
yum -y install gcc44*
3.列出gcc版本,准备切换新版本
ls /usr/bin/g*
结果中包括以下几个文件:
/usr/bin/g++
/usr/bin/g++44
/usr/bin/gcc
/usr/bin/gcc44
/usr/bin/gcov
/usr/bin/gcov44
4.切换版本
sudo mv /usr/bin/g++ /usr/bin/g++41
sudo mv /usr/bin/gcc /usr/bin/gcc41
sudo mv /usr/bin/gcov /usr/bin/gcov41
sudo mv /usr/bin/gcov44 /usr/bin/gcov
sudo mv /usr/bin/gcc44 /usr/bin/gcc
sudo mv /usr/bin/g++44 /usr/bin/g++
在centos5.8下安装vim
在centos5.8里需要使用yum -y install vim-*来完成。
fedora安装vim失败的原因
如果报下错误:
原因是vi的版本太低。需要更新vi的版本。
yum update vi
然后再安装
yum install vim
phantomjs生成调试信息
使用以下一组参数,可生成调试信息供GDB调试。
CFLAGS=-g CXXFLAGS=-g ./build.sh –qt-config ‘-webkit-debug’ –qmake-args “QMAKE_CFLAGS=-g QMAKE_CXXFLAGS=-g”
http://phantomjs.org/crash-reporting.html
SQL复杂查询最大组最大记录优化记录
SELECT w.*,p.id,p.price FROM wareprice_01 p,(SELECT a.wareid,a.platform,`value` attr,attrid,title,url,shopid FROM wareattr_01 a,ware_01 w
WHERE a.wareid = w.wareid AND a.platform=w.platform AND (`value` LIKE ‘%月光石%’ OR title LIKE ‘%月光石%’) GROUP BY a.wareid) w
WHERE w.wareid=p.wareid AND w.platform=p.platform AND p.id=(SELECT MAX(id) FROM wareprice_01 t WHERE p.wareid=t.wareid);
SELECT nw.*,np.id,np.price FROM (SELECT price,platform,id,wareid FROM wareprice_01 p1 WHERE id=(SELECT MAX(id) FROM wareprice_01 p2 WHERE p1.wareid=p2.wareid)) np,(SELECT a.wareid,a.platform,`value` attr,attrid,title,url,shopid FROM wareattr_01 a,ware_01 w
WHERE a.wareid = w.wareid AND a.platform=w.platform AND (`value` LIKE ‘%月光石%’ OR title LIKE ‘%月光石%’) GROUP BY a.wareid) nw WHERE np.wareid=nw.wareid AND np.platform=nw.platform;
SELECT s.*,wp.* FROM shop s,(SELECT nw.*,p.id,p.price FROM wareprice_01 p,(SELECT a.wareid,a.platform,`value` attr,attrid,title,url,shopid FROM wareattr_01 a,ware_01 w WHERE a.wareid = w.wareid AND a.platform=w.platform AND (a.`value` LIKE ‘%月光石%’ OR title LIKE ‘%月光石%’) GROUP BY a.wareid) nw WHERE nw.wareid=p.wareid AND nw.platform=p.platform AND p.id=(SELECT MAX(id) FROM wareprice_01 p2 WHERE p.wareid=p2.wareid)) wp WHERE s.id = wp.shopid;
SELECT * FROM wareprice_01 w1 WHERE id=(SELECT MAX(id) FROM wareprice_01 w2 WHERE w1.wareid=w2.wareid);
SELECT * FROM wareprice_01 w1 WHERE id IN (SELECT MAX(id) FROM wareprice_01 w2 WHERE w1.wareid=w2.wareid) LIMIT 5000;
SELECT * FROM wareprice_01 w1 GROUP BY wareid LIMIT 5000;消耗比较高
Linux解决中文乱码和安装五笔输入法
sudo yum remove ibus --会将所有的输入法删除
安装ibus,ibus-table
sudo yum install ibus ibus-table --这样只会安装ibus的输入框架
sudo yum install ibus-table-wubi
yum install “@Chinese Support”
安装中文语言支持包
yum -y groupinstall chinese-support解决中文显示问题
yum -y install Deployment_Guide-zh-* lv-* stardict*
yum -y install scim*安装中文输入法
yum install scim
yum install scim-pinyin
yum install “@Chinese Support” centos6.6
重启,然后在编辑窗口按ctrl+space键即可呼出输入法。
Centos开发环境安装快速命令
快捷命令(Centos7环境特别建议该方式,因为gcc是4.8.5,gdb是7.6.1):
yum groupinstall ‘Development Tools’
你也可以这样:
yum -y install firefox gcc gcc-c++ autoconf automake gdb git perl svn libtool flex bison pkgconfig vim subversion git lrzsz openssl curl wget curl p7zip mysql openssl-devel mysql-server mysql-devel zlib-devel curl-devel
yum install -y python-devel libxml2-devel libxslt-devel python-lxml sqlite-devel libffi-devel openssl-devel mysql-server mysql-devel zlib-devel curl-devel