岚天逸见

随笔分类 -  C/C++

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

C++常见gcc编译链接错误解决方法
摘要:除非明确说明,本文内容仅针对x86/x86_64的Linux开发环境,有朋友说baidu不到,开个贴记录一下(加粗字体是关键词):用“-Wl,-Bstatic”指定链接静态库,使用“-Wl,-Bdynamic”指定链接共享库,使用示例:-Wl,-Bstatic -lm... 阅读全文

posted @ 2016-07-08 15:44 岚天逸见 阅读(2913) 评论(0) 推荐(0) 编辑

Redis Cluster原理初步
摘要:目录目录 11. 前言 12. 槽(slots) 13. 路由配置(node.conf) 14. 总slots数(cluster.h:16384) 25. key的路由 26. 将key转成整数值(crc16.c:crc16) 27. 计算key所在slot(clus... 阅读全文

posted @ 2016-05-16 17:03 岚天逸见 阅读(168) 评论(0) 推荐(0) 编辑

测试setsockopt设置超时是否生效代码
摘要:// 测试setsockopt设置超时是否生效代码#include #include #include #include #include #include #include #include // 编译:// g++ -g -o x x.cppint main(){... 阅读全文

posted @ 2016-05-12 14:55 岚天逸见 阅读(1171) 评论(0) 推荐(0) 编辑

批量远程执行shell命令工具
摘要:使用示例(使用了默认用户root,和默认端口号22):./mooon_ssh --h=192.168.4.1,192.168.4.2 -P=password -c='cat /etc/hosts'#include "mooon/net/libssh2.h" // 提供... 阅读全文

posted @ 2016-04-01 09:50 岚天逸见 阅读(253) 评论(0) 推荐(0) 编辑

代码的演变随记
摘要:1) 使用sizeof操作符替代魔鬼数字if (s1.substr(0, 10) == s2)改成:if (s1.substr(0, sizeof("YYYY-MM-DD")-1) == s2)2) 长的放后头if (s2 == s1.substr(0, sizeof... 阅读全文

posted @ 2016-03-28 14:19 岚天逸见 阅读(160) 评论(0) 推荐(0) 编辑

iconv用法解读
摘要:iconv是一个字符集转换函数,原型为:size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbyte... 阅读全文

posted @ 2016-01-29 13:55 岚天逸见 阅读(2003) 评论(0) 推荐(0) 编辑

HBase & thrift & C++编程
摘要:目录目录 11. 前言 12. 启动和停止thrift2 12.1. 启动thrift2 12.2. 停止thrift2 12.3. 启动参数 23. hbase.thrift 23.1. 编译hbase.thrift 24. thrift_helper.h 35. ... 阅读全文

posted @ 2016-01-27 16:12 岚天逸见 阅读(978) 评论(0) 推荐(0) 编辑

“undefined JNI_GetCreatedJavaVM”和“File format not recognized”错误原因分析
摘要:如果编译时,报如下所示错误:../../third-party/hadoop/lib/libhdfs.a(jni_helper.c.o): In function `getGlobalJNIEnv':/root/hadoop-2.4.0-src/hadoop-hdfs... 阅读全文

posted @ 2015-11-13 17:12 岚天逸见 阅读(395) 评论(0) 推荐(0) 编辑

C/C++编程可用的Linux自带工具
摘要:GNU Binary Utilities或binutils是一整套的编程语言工具程序,用来处理许多格式的目标文件。当前的版本原本由在Cygnus Solutions的程序员以Binary File Descriptor library(libbfd)所撰写。这个工具程... 阅读全文

posted @ 2015-11-13 16:42 岚天逸见 阅读(326) 评论(0) 推荐(0) 编辑

安装gcc及其依赖
摘要:在gcc-4.8.2和gcc-4.1.2基础上编译gcc-5.2.0,有可能会遇到一些问题。 要想成功编译gcc,则在编译之前需要安装好它的至少以下三个依赖: gmp mpfr mpc 而mpc又依赖gmp和mpfr。 1) 安装gmp ./configure --prefix=/usr/local 阅读全文

posted @ 2015-11-13 11:52 岚天逸见 阅读(2366) 评论(0) 推荐(0) 编辑

Linux上编译hadoop-2.7.1的libhdfs.so和libhdfs.a
摘要:hadoop提供了CMake来编译libhdfs,因此在编译之前需要先安装好CMake工具。然后进入libhdfs的源代码目录,如:/data/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src执行cmake以生成... 阅读全文

posted @ 2015-11-13 11:00 岚天逸见 阅读(878) 评论(0) 推荐(0) 编辑

gcc链接参数--whole-archive的作用
摘要:// a.hextern void foo(); // a.cpp#include void foo(){ printf("foo\n");} // x.cpp#include "a.h" int main(){ foo(); re... 阅读全文

posted @ 2015-11-12 15:54 岚天逸见 阅读(1989) 评论(0) 推荐(0) 编辑

CMake使用技巧集
摘要:1、注意CMake不允许出现相同的目标名称,即使是不同的目录下的CMakeLists.txt2、将头文件搜索路径插入到其它的前面:include_directories(BEFORE /tmp)当使用CMake的include复用规则时,如果想让某头文件路径至于其它的... 阅读全文

posted @ 2015-10-26 15:32 岚天逸见 阅读(283) 评论(0) 推荐(0) 编辑

编译期强制函数参数为字符串常量
摘要:设计一函数f(),使用得下面代码中的第一个f()调用可正常编译,而其它编译报错#include #include int main(){ f("hello"); // 正常编译通过 const char* str1 = "hello"; f(... 阅读全文

posted @ 2015-10-20 17:44 岚天逸见 阅读(195) 评论(0) 推荐(0) 编辑

arean.c
摘要:glibc-2.14中的arean.c源代码,供研究malloc和free实现使用:/* Malloc implementation for multiple threads without lock contention. Copyright (C) 2001,... 阅读全文

posted @ 2015-10-09 15:48 岚天逸见 阅读(178) 评论(0) 推荐(0) 编辑

malloc.c
摘要:glibc-2.14中的malloc.c源代码,供研究malloc和free实现使用:/* Malloc implementation for multiple threads without lock contention. Copyright (C) 1996... 阅读全文

posted @ 2015-10-09 15:46 岚天逸见 阅读(700) 评论(0) 推荐(0) 编辑

__lll_mutex_lock_wait的错误原因
摘要:1. x86_64栈(glib 2.4):free时:(gdb) bt#0 0x00002b9405ea1c38 in __lll_mutex_lock_wait () from /lib64/libc.so.6#1 0x00002b9405e45e5f in _... 阅读全文

posted @ 2015-10-09 15:35 岚天逸见 阅读(412) 评论(0) 推荐(0) 编辑

rapidjson常见使用示例
摘要:rapidjson相比jsoncpp性能高出太多,使用接口一样的简单的。官方中文帮助文档:http://rapidjson.org/zh-cn/。rapidjson的Move语意,请浏览http://rapidjson.org/zh-cn/md_doc_tutoria... 阅读全文

posted @ 2015-09-25 19:19 岚天逸见 阅读(8422) 评论(0) 推荐(0) 编辑

程序员不常用Linux命令集
摘要:1) 关闭指定网卡,如关闭网卡eth0ifconfig eth0 down也可以使用ifdown,通常ifdown是一个指向ifup的软链接,而ifup为一个脚本文件。2) 命令自启动,如希望机器重启时自动关闭网卡eth0这个只需要在文件/etc/rc.d/rc.lo... 阅读全文

posted @ 2015-09-19 11:08 岚天逸见 阅读(180) 评论(0) 推荐(0) 编辑

再议GCC编译时的静态库依赖次顺问题
摘要:假设有如三个源代码文件:$ cat a.cppvoid a(){} $ cat b.cppextern void a();void b(){ a(); // 调用a.cpp中的a()} $ cat x.cppextern void b();int main(){... 阅读全文

posted @ 2015-09-18 15:49 岚天逸见 阅读(869) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

导航

统计信息

点击右上角即可分享
微信分享提示