- 博客(114)
- 收藏
- 关注
转载 fread读取文件丢失字节
fread(xxxxx,"r");以读的方式读取二进制文件,发现存在字节丢失的情况改成fread(xxxxx,"rb");以二进制的方式读取原因:fread以文本形式读取对0x0D 0x0A会变成0x0A【C语言】fwrite 写如0X0A时,自动添加0X0D的解决方法回车换行问题0x0D和0x0A转载于:https://www.cnb...
2019-09-12 16:19:00 1346
转载 nginx记录
"geo" directive is not allowed here => NGINXnginx -Vnginx version: nginx/1.10.3built with OpenSSL 1.1.0f 25 May 2017TLS SNI support enabledconfigure arguments: --with-cc-opt='-g -O...
2019-06-28 15:36:00 234
转载 C++ make编译库出问题
问题表象:使用编译出来的库,会报一大堆未定义的引用而这些未定义函数都来在那个库所依赖的boost和pthread给项目链接时也加上了-lpthread lboost_system现在还不知道为什么报错。##以为是import和export的原有,比较了下levelDB好像linux下并不需要这个前缀在自己的文章里解决该问题转载于:https://www....
2019-06-04 15:20:00 246
转载 交叉编译boost
运行bootstrap.sh修改project-config.jamusing gcc;=>using gcc : arm : arm-none-linux-gnueabi-g++ ;./b2 --prefix=/opt/boost/ cxxflags="-std=c++0x"虽然我添加了C++11标准的flags,但是到实际调用库时加上C++11的flag...
2019-05-08 16:11:00 257
转载 Ubuntu18.04关机卡死问题
直接进入正题!你的电脑卡死说明带有独显!而Ubuntu默认是不给你的显卡装驱动的,那这就导致关机卡死的问题。按住键盘Ctrl+Alt+T打开终端,输入下面的命令software-properties-gtk选择附加驱动,等一会你就会发现有自己的驱动选择了含Nvidia那个,选择那个选项,然后应用即可。然后你的电脑就可以正常关机!--------------------- 原文:https...
2019-04-21 21:04:00 1066
转载 C++ 左值与右值 右值引用 引用折叠 => 完美转发
左值与右值什么是左值?什么是右值?在C++里没有明确定义。看了几个版本,有名字的是左值,没名字的是右值。能被&取地址的是左值,不能被&取地址的是右值。而且左值与右值可以发生转换。我个人的理解就是在当前作用域下右值是个临时变量。举例如下:https://blog.csdn.net/wangshubo1989/article/details/50479162...
2019-03-29 16:03:00 150
转载 uninitialized_copy()效果试验
根据《STL源码剖析》这段节选描述,实现如下代码进行测试#include "2jjalloca.h"#include <vector>#include <iostream>#include <memory>class INT {public: INT(int i) : m_...
2019-03-28 20:13:00 267
转载 《STL源码剖析》----2.23 value_type()和__type_traits<>如何实现
在2.13小节destory()第二版本接受两个迭代器找出元素类型,代码如下其中value_type()判断出类型,__type_traits判断是否存在trivial destructor在3.7详细介绍如何实现。__type_traits我记得在muduo内见到过这个实现。转载于:https://www.cnblogs.com/Jacket-K/p/10608948....
2019-03-27 17:14:00 115
转载 Linux系统网络编程中TCP通讯socket--send导致进程被关闭
https://blog.csdn.net/dsanmux/article/details/52083403https://blog.csdn.net/u011425939/article/details/81835968send(sockfd, buff, sizeof(buff), 0);在linuxTCP通讯中上述send形式是常用的设置方式,但是如果在TCP链接断开...
2019-01-09 09:54:00 191
转载 Glog使用记录
1.Flag_xxxFLAGS_logtostderr = false; //是否将所有日志输出到stderr,而非文件FLAGS_alsologtostderr = false; //日志记录到文件的同时输出到strerrFLAGS_colorlogtostderr = false; //将彩色日志输出到s...
2018-12-20 11:16:00 641
转载 std::async使用详解
https://www.jianshu.com/p/6e9cfa25be2f转载于:https://www.cnblogs.com/Jacket-K/p/10118283.html
2018-12-14 11:06:00 234
转载 atomic详解
http://www.360doc.com/content/14/1120/21/203028_426770242.shtml转载于:https://www.cnblogs.com/Jacket-K/p/10114431.html
2018-12-13 15:49:00 258
转载 原子性详解
http://www.knowsky.com/1055543.html显示volatile保证可见性。大致实现就是被该关键字修饰的变量每次写操作都会保证写到内存而非单纯寄存器,每次读操作都会保证从内存读出而非读寄存器里的副本。其次就是CAS技术,每次写操作都会比较内存现有值和旧值是否一致,不一致则重新执行写操作。可见性保证可以保证set和get。转载于:https://w...
2018-12-13 15:32:00 88
转载 Inheritance: 'A' is an inaccessible base of 'B'
'boost::enable_shared_from_this<net::Session>' is an inaccessible base of 'net::Session' BOOST_ASSERT( p.get() == this );在使用enabel_shared_from_this是遇到报错研究了一下是继承的时候没有采用publ...
2018-12-07 10:40:00 171
转载 Qt调用自己编译的libglog.a出现问题
我确定依据正确导入库后,依旧出现未定义的引用。undefined reference to _imp___ZN6google17InitGoogleLoggingEPKc尝试过重新编译,调整编译参数,都不行。debug和release模式也没有影响。最后找到Stack Overflow上有这样一个问题https://stackoverflow.com/question...
2018-12-05 17:23:00 412
转载 如何查看C++ dll位数
使用VS自带工具 dumpbindumpbin /headers xxx.dll转载于:https://www.cnblogs.com/Jacket-K/p/9882137.html
2018-10-31 11:36:00 826
转载 GCC __builtin_expect的作用
https://blog.csdn.net/shuimuniao/article/details/8017971#define LIKELY(x) __builtin_expect(!!(x), 1) //x很可能为真#define UNLIKELY(x) __builtin_expect(!!(x), 0) //x很可能为假CurrentThread.h...
2018-10-23 14:27:00 123
转载 gcc __thread关键字
https://blog.csdn.net/xj178926426/article/details/54345449EventLoop.cpp__thread EventLoop* t_loopInThisThread = 0;EventLoop::EventLoop() { if (t_loopInThisThread) { LOG(INFO...
2018-10-23 12:03:00 164
转载 Ubuntu16.04 安装g++6
https://blog.csdn.net/qq_34877350/article/details/811820221.安装gcc-6:sudo apt-get update && \sudo apt-get install build-essential software-properties-common -y && \sudo a...
2018-10-22 15:55:00 700
转载 Ubuntu16.04 g++5.4依旧不支持C++11问题
jacket@jacket:~$ g++ -vUsing built-in specs.COLLECT_GCC=g++COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapperTarget: x86_64-linux-gnuConfigured with: ../src/configure -v ...
2018-10-22 15:16:00 597
转载 Ubuntu18.04 安装32bit库后出现问题
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.参考https://github.com/lutris/lutris/issues/905解决方法sudo apt-get i...
2018-10-18 15:10:00 573
转载 openCV 3.0 Ubuntu下编译问题
1.有个ipptv啥的东西下布下来,去官网下载放到相应目录2.把编译器降级到5版本才能编译转载于:https://www.cnblogs.com/Jacket-K/p/9810533.html
2018-10-18 15:02:00 86
转载 可变参数 未定义的引用
尝试写了可变参数作为一个类的成员函数,编译时却提示未定义的引用研究原因,其实就是编译器必须知道在专门化模板时模板是什么。详细解释:https://ask.helplib.com/c++/post_4028588转载于:https://www.cnblogs.com/Jacket-K/p/9752808.html...
2018-10-08 10:08:00 132
转载 expansion pattern ‘Frame&’ contains no argument packs
camera/CameraImpl.h:79:42: error: expansion pattern ‘Frame&’ contains no argument packs void read_frame(Frame& varg, Frame& ... args);在尝试变长参数的时候出现如上错误。当时使用指针是没问题的,换成引用报错了。c...
2018-10-07 17:11:00 505
转载 Sublime text 3支持utf-8
首先安装插件ConvertToUTF8和Codecs33Sublime Text 3中文乱码问题解决(最新)然后配置一些有用的用户设置2. 使文档保存时自动存为 UTF-8 编码格式默认情况下,使用 ConvertToUTF8 打开并保存的文件会保留原来的编码格式,但我的需求是完全使用 UTF-8 编码,这个可以在其用户设置中写下如下配置:"convert...
2018-10-01 10:06:00 499
转载 ubuntu17.10 安装firefox的flash
1. flash下载地址:https://get.adobe.com/flashplayer/2. 选择tar.gz for linux3. 下载后解压tar包。里面有个libflashplayer.so,将该文件拷贝到~/.mozilla/plugins/下,重启浏览器即可。(如果没有plugins目录,自行创建。)转载于:https://www.cnblogs.c...
2018-09-30 21:59:00 49
转载 opencv mat裁剪
主要记录的就是对Mat裁剪后,新Mat指向的内存和原来的Mat共用。OpenCV入门教程(3)-Mat类之选取图像局部区域转载于:https://www.cnblogs.com/Jacket-K/p/9679667.html...
2018-09-20 11:12:00 3364
转载 Ubuntu寻找某某库
感觉这个方法很有用,记录一下ubuntu14.04的error while loading shared libraries: libz.so.1问题我们怎么这知道 libz.so.1在哪个包?主要看操作sudo apt-get install apt-filesudo apt-file updateapt-file sea...
2018-09-20 11:10:00 97
转载 Ubuntu的 g++ gcc版本升降级
更改gcc默认版本(gcc版本降级/升级)### 以降级到gcc-6为例>* sudo apt install gcc-6 g++-6>* sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 100 #数字大优先级高>* sudo update-alternatives -...
2018-09-18 09:32:00 116
转载 Autotools知识点
最近研究了下glog使用autotools编译方法的脚本文件,略有所得configure.acAC_INIT初始化一些信息 Package Version ReportBugAC_CONFIG_MACRO_DIR([m4])加载 m4目录下的规则脚本 应该需要aclocal一下先,把规则集成到aclocal.m4AM_CONFIG_HEADER(src/config.h)...
2018-08-23 10:57:00 100
转载 Counted(内存管理机制)
1 class Counted { 2 private: 3 unsigned int count_; 4 public: 5 Counted() : 6 count_(0) { 7 } 8 virtual ~Counted() { 9 }10 Counted *retain() {11 count...
2018-08-09 09:59:00 357
转载 operator new和operator delete
从STL源码剖析中看到了operator new的使用template<class T>inline void _deallocate(T* buffer) { ::operator delete(buffer); //operator delete可以被重载// operator delete(buffer);}从...
2018-07-19 17:31:00 152
转载 STL学习笔记:空间配置器allocator
allocator必要接口:allocator::value_typeallocator::pointerallocator::const_pointerallocator::referenceallocator::const_referenceallocator::size_typeallocator::difference_ty...
2018-07-18 15:10:00 135
转载 function call操作符(operator()) 仿函数(functor)
主要是需要某种特殊的东西来代表一整组操作代表一整组操作的当然是函数,过去通过函数指针实现所以STL算法的特殊版本所接受的所谓条件或策略或一整组操作都以仿函数的形式呈现 1 #include <iostream> 2 3 4 /*! 5 * 所谓仿函数(functor)就是使用起来像函数一样的东西, 6 * 如果你针对某个class进...
2018-07-10 10:14:00 158
转载 increment/decrement/dereference操作符
标题以上分别对于++/--/* 1 #include <iostream> 2 #include <cstddef> 3 4 using namespace std; 5 6 class INT { 7 friend ostream& operator<<(ostream& os, const...
2018-07-09 16:48:00 83
转载 template specifiers not specified in declaration of ‘template<class Key> class hash’
尝试写显示特化样例的时候,写了如下代码#include <iostream>#include <cstddef>using namespace std;#define __STL_TEMPLATE_NULL template<>template<class Key>class hash {publ...
2018-07-09 11:00:00 278
转载 C++ template一些体悟(3)
其实没啥体悟,因为还没有感受到这些例子的作用,记一下先 1 #include <iostream> 2 3 using namespace std; 4 class alloc { 5 6 }; 7 8 template<class T, class Alloc = alloc> 9 class vector {...
2018-07-04 17:10:00 120
转载 C++ template一些体悟(2)
class template的一般化设计之外,特别针对某些参数做特殊设计#include <iostream>using namespace std;//一般设计template<class I, class O>class testClass {public: testClass() { cout &l...
2018-07-04 14:50:00 1250
转载 C++ template一些体悟(1)
#include <iostream>using namespace std;template<typename T>class testClass {public: static T _data;};template<typename T>T testClass<T>::_data =...
2018-07-04 09:49:00 77
转载 C regex.h
C也是存在正则表达式的Linux下regex.h知识点和使用样例上文中有一个样例代码,进行了测试总结一下有些注意点:1.上述代码的匹配子串很奇怪,为什么会出现cnt=6 a verycnt=1 acnt=4 verycyc:**************3的结果??2.可以使用^xxxx$来限定字符串从开头到结尾都要匹...
2018-07-03 17:09:00 295
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人