随笔分类 -  C/C++

摘要:介绍 protobuf是用来对数据进行序列化和反序列化的灵活,高效,自动化的解决方案。 序列化:将数据结构转换成二进制的字节串 反序列化:将二进制串还原成数据结构 Ubuntu下编译安装 尝试安装最新版本-v3.22.1(没成功) 参照文档的安装过程 github-protocol-readme 这 阅读全文
posted @ 2023-04-16 10:26 WuYunTaXue 阅读(1820) 评论(0) 推荐(0) 编辑
摘要:Effective C++ Third Edition 改善程序与设计的55个具体做法 导读 除非有理由允许构造函数被用于隐式类型转换,否则‘我’会把它声明为explicit(阻止隐式类型转换) class tmp{ public: explicit tmp(int a) : numa(a){ } 阅读全文
posted @ 2023-03-28 23:08 WuYunTaXue 阅读(45) 评论(0) 推荐(0) 编辑
摘要:条件变量 std::condition_variable,类似Linux C中的pthread_cond_t 可以用来阻塞当前线程,等待其他线程通知解除阻塞 condition_variable std::condition_variable 条件变量类 void condition_variabl 阅读全文
posted @ 2023-03-02 22:02 WuYunTaXue 阅读(34) 评论(0) 推荐(0) 编辑
摘要:lock_guard和unique_lock互斥锁 std::mutex是c++基础的互斥锁 为了避免有些场景下忘记unlock导致的死锁,c++11引入了std::unique_lock和std::lock_guard两种数据结构。实现自动unlock的功能。 lock_guard lock_gu 阅读全文
posted @ 2023-01-01 15:57 WuYunTaXue 阅读(422) 评论(0) 推荐(0) 编辑
摘要:Doxygen 从源码中提取注释自动生成文档,可以是HTML网页形式,也可以最终生成PDF vscode插件 在拓展选项搜索下载插件:Doxygen Documentation Generator 设置 在File--Preferences--Settings界面的Extensions选项找到Dox 阅读全文
posted @ 2022-07-04 21:35 WuYunTaXue 阅读(1372) 评论(0) 推荐(0) 编辑
摘要:git_hash git log -1 --format="%h" #获取最新commit的hash短值, -n表示获得前几条的数据:-1最新一条 %h表示截取hash值的前一段,%H则表示整个hash值 git tag git describe --abbrev=6 --always --tags 阅读全文
posted @ 2022-05-12 23:22 WuYunTaXue 阅读(545) 评论(0) 推荐(0) 编辑
摘要:在x64 Ubuntu交叉编译arm64的boost库 下载源码(官网、GitHub) https://www.boost.org/ https://github.com/boostorg/boost 解压源码,进入目录 执行bootstrap.sh sudo ./bootstrap.sh --wi 阅读全文
posted @ 2022-03-05 09:36 WuYunTaXue 阅读(1358) 评论(0) 推荐(0) 编辑
摘要:格式化生成字符串 除了sprintf函数,c++中还可以使用的格式化字符串方式。 boost库 #include<boost/format.hpp> std::string s1("qwer"); char c1 = 't'; int a1 = 5; boost::format wor = boos 阅读全文
posted @ 2022-02-10 15:24 WuYunTaXue 阅读(86) 评论(0) 推荐(0) 编辑
摘要:参考: https://blog.csdn.net/Mculover666/article/details/103796256 cjson一般使用一个git上的项目 https://github.com/DaveGamble/cJSON 工程里都很多文件,使用时只需要将cJSON.c和cJSON.h 阅读全文
posted @ 2021-11-07 16:15 WuYunTaXue 阅读(1059) 评论(0) 推荐(0) 编辑
摘要:在cmake官网,下载指定版本的的cmake包 https://cmake.org/files/ 例如:当选择3.20版本文件夹时,找到如图所示的文件 选择对应系统的执行程序,或者选择源码再进行编译安装 我这里选择官方提供的可执行程序:cmake-3.20.6-linux-x86_64.tar.gz 阅读全文
posted @ 2021-11-06 17:31 WuYunTaXue 阅读(3867) 评论(0) 推荐(0) 编辑
摘要:均在Ubuntu18.04上验证,cmake版本是3.10.2 基础 sudo apt install cmake #安装cmake cmake 路径 #创建cmake工程,创建Makefile cmake --build 路径 #编译工程 CmakeLists.txt常用规则 指定源文件 #指定文 阅读全文
posted @ 2021-11-02 19:16 WuYunTaXue 阅读(254) 评论(0) 推荐(0) 编辑
摘要:A Basic Starting Hello World(for unix os like) 在源码目录新建一个名为CMakeLists.txt的文件,文件三行内容如下: cmake_mininum_required(VERSION 3.10) #set the project name proje 阅读全文
posted @ 2021-11-02 16:50 WuYunTaXue 阅读(52) 评论(0) 推荐(0) 编辑
摘要:函数说明 //函数原型,定义在<unistd.h> int getopt(int argc, char * const argv[], const char *optstring); //描述:getopt是用来解析命令行选项参数的,但是只能解析短选项: -d 100,不能解析长选项:--prefi 阅读全文
posted @ 2021-09-09 23:06 WuYunTaXue 阅读(63) 评论(0) 推荐(0) 编辑

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