2020年3月6日
编写Makefile文件时,避免Tab转换为4个空格 先敲ctrl-v组合键,再敲tab键,这样就不会被转换成空格了
……
阅读全文
2020年2月6日
一、配置允许生成的 core 文件数量 vim /etc/security/limits.conf 添加 * soft core 1024 # 表示允许生成的最大 core 数量为 1024 二、配置 core 文件名 # format the name of core file. # %% – 符号% # %p – 进程号 # %u – 进程用户id # %g – 进程用户组id # %s – 生成core文件时收到的信号 # %t – 生成core文件的时间戳(seconds since 0:00h, 1 Jan 1970) # %h – 主机名 # %e – 程序文件名 echo -e "core-%p-%t" > /proc/sys/kernel/core_pattern # or run the following command # sysctl -w kernel.core_pattern=/corefile/core-%p-%t # 注意: 这个配置重启机器后,会失效。需要重新设置或者采用永久配置生效方法 三、 配置 core 使用 pid (此步骤可不配置) echo -e "1" > /proc/sys/kernel/core_uses_pid # or run the following command # sysctl -w kernel.……
阅读全文
2019年6月6日
一、为什么要使用 cmake cmake 可以实现 c/c++ 跨平台代码的编译 二、cmake 简单使用 # the minimum version cmake_minimum_required(VERSION 3.10) # set the project name project(Tutorial VERSION 1.0) # set verbose set(CMAKE_VERBOSE_MAKEFILE on) # add the executable add_executable(Tutorial tutorial.cxx) configure_file(TutorialConfig.h.in TutorialConfig.h) target_include_directories(Tutorial PUBLIC "${PROJECT_BINARY_DIR}" ) # specify the C++ standard set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) //TutorialConfig.h.in // the configured options and settings for Tutorial #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ // tutorial.cxx #include <iostream> #include <cmath> #include <cstdlib> #include "TutorialConfig.……
阅读全文
2019年6月6日
一、vector 中的数据删除 vector 中删除元素,使用 erase 来达到目的 int main() { vector<int> vecInts; vecInts.push_back(1); vecInts.push_back(2); vecInts.push_back(3); vecInts.push_back(3); vecInts.push_back(4); // 删除一个中间的非相同元素,这种方法可以达到目的 // for (auto it = vecInts.begin(); it != vecInts.end(); it++) { // if (*it == 2) { // vecInts.erase(it); // } // } // 删除相邻相同的元素 // for (auto it = vecInts.begin(); it != vecInts.end(); it++) { // if (*it == 3) { // vecInts.erase(it); //出现 core, 由于迭代器改变 // } // } // 删除元素在最后 // for (auto it = vecInts.……
阅读全文
2019年6月4日
一、查看CentOS 版本号 cat /etc/redhat-release
二、下载 repo 包 根据以下查到的版本号,到 http://www.city-fan.org/ftp/contrib/yum-repo/ 查找对应版本的 rpm
如 CentOS Linux release 7.6.1810 (Core) ,执行以下命令下载: rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel7.noarch.rpm
三、更新 Curl // 将 city-fan.org.repo 中的 enabled=1 更新为 enabled=0 vim /etc/yum.repos.d/city-fan.org.repo // 更新 yum --enablerepo=city-fan.org update curl ……
阅读全文