
C++
robothn
这个作者很懒,什么都没留下…
展开
-
VirtualBox 下搭建Ubuntu18.04开发环境
虚拟机使用 Oracle VirtualBox,操作系统使用 Ubuntu18.04,集成开发环境使用 VSCode,构建系统使用 cmake,编译器使用 llvm/clang 6.0,调试器使用 lldb。下面记录了大部分问题和解决步骤:安装 Ubuntu 18.04: 安装虚拟机:Oracle VirtualBox,这是一款免费软件。下载地址https://www.virtualbox...原创 2020-04-22 17:42:31 · 589 阅读 · 0 评论 -
给 C++ 类加上 property,the Simplest way
看了几个给 C++ 添加 property 的实现,觉得都挺麻烦,现在自己造个templateclass T>struct TypeTraits{ typedef T value_type; typedef T &reference; typedef T const &const_reference; type原创 2008-11-28 16:20:00 · 944 阅读 · 1 评论 -
从 windows 到 linux(2):要注意 linux 上文件名大小写
看日志文件时,没注意到上面的错误信息,只看到了最下面原创 2014-10-28 14:19:24 · 1647 阅读 · 0 评论 -
从 windows 到 linux(3):std::list::erase 不能用 const_iterator
../src/map_server/Team/RandomTeamManager.cpp: In member function ‘void RandomTeamManager::_HandleConfirmTeam(uint32, bool)’:../src/map_server/Team/RandomTeamManager.cpp:138: error: no matching functi原创 2014-11-20 17:35:49 · 786 阅读 · 0 评论 -
从 windows 到 linux(1):g++不能用函数内定义的类型做模板参数
error: template argument for ‘template struct std::pair’ uses local type ‘QuestMgr::LoadDb_Quests(IdQuestObjMap&)::ItemsEntryForQuest’原创 2014-10-11 17:47:24 · 854 阅读 · 0 评论 -
使用 boost::property_tree::ptree 读取配置文件
近期有一需求:需要一个地址配置项,同时提供一个地址列表,读取的地址如果在地址列表内,则自动替换,大概的 json 配置文件如下:{ "host_list" : { "BDC" : "chn.xxx.com", "MDC" : "alpha01.xxx.com", "vm" : "10.209.9.83", "local" : "127.0.0.1" }, "host" : {原创 2015-05-05 11:23:04 · 2927 阅读 · 0 评论 -
ffmpeg 内av_frame_move_ref 误用导致的内存泄漏
/** * Move everything contained in src to dst and reset src. */void av_frame_move_ref(AVFrame *dst, AVFrame *src);看到这个函数声明,我第一感觉是它也会先 reset dst,其实我错了,如果你没有先调用 av_frame_unref(dst),这个函数会导致大量的内存泄原创 2016-08-11 11:39:01 · 5317 阅读 · 0 评论 -
解决使用 libcurl 遇到的多线程崩溃问题
使用 curl 访问 http 链接时,用 easy handle,阻塞方式访问时发现会每个访问启动一个线程去进行dns想减少这种消耗,故此采用了 sh = curl_share_init(); curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);来启用dns cache功能,工作的挺好后面在多个线程里使用同一个 sh原创 2017-12-04 17:33:26 · 4854 阅读 · 1 评论 -
TensorFlow 1.13 在 windows 上的构建
一.使用CMake + VS2015 IDE编译(失败,结果导向的看后面用 Bazel编译)准备工作安装 cmake 3.12+ (3.9+应该也可以) 下载 swigwin-3.0.12,从 http://prdownloads.sourceforge.net/swig/swigwin-3.0.12.zip 选个镜像下载,因为这个版本内有编译好的swig.exe,用来生成 python...原创 2019-01-11 11:32:36 · 11123 阅读 · 4 评论