摘要:project/ ├── core/ │ └── system_init.c // 核心框架代码,包含弱函数 ├── boards/ │ └── my_board.c // 板级特定代码,提供强函数 └── main.c // 主程序 //定义一系列弱的初始化钩子 __weak void clock
阅读全文
摘要:#include<stdio.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<stdlib.h> #include<unistd.h> #include<sys/ioctl.h> #include<sy
阅读全文
摘要:某些Linux服务器会安装不同版本的SSL;导致编译出来的SO依赖了多个不同版本 这时候在这个机器运行so的执行程序就会包SSL冲突;换一个服务器或者删除其他版本的SSL warning: libcrypto.so.1.1, needed by /usr/lib/gcc/x86_64-redhat-
阅读全文
摘要://代码来源于教材(重庆大学 基于Dx11的案例教程)#pragma once #include <iostream> #include<d3dcompiler.h> #include <DirectXMath.h> #include<d3d11.h> #include<dxgi.h> using
阅读全文
摘要:64路以及以下路数的NVR的IP通道通道号从33开始,64路及以上路数的NVR的IP通道通道号从1开始 所以若您的通道数小于64路,通道号传入的参数为:32+第几通道号 #include <stdio.h> #include <iostream> #include "Windows.h" #incl
阅读全文
摘要:#include <iostream> struct AAA { ~AAA() { printf("delete AAA \n"); if (data) { delete[]data; } data = NULL; len = 0; } char* data = NULL; int len = 0;
阅读全文
摘要:带超时等待的信号量 ;摘抄自ZLM /* * Copyright (c) 2016 The ZLToolKit project authors. All Rights Reserved. * * This file is part of ZLToolKit(https://github.com/ZL
阅读全文
摘要:std::fun 抽象 #include <iostream> #include <functional> class MyClass { public: void func1(int x) { std::cout << "func1: " << x << std::endl; } void fun
阅读全文
摘要:现象: tcp绑定端口和IP,生成FD; lsof发现运行时,其他进程也在监听该FD; 并没有使用共享端口和地址SO_REUSEPORT SO_REUSEADDR 在Linux系统中,fork()函数会创建一个子进程,该子进程是父进程的副本,包括文件描述符在内的资源也会被继承。如果希望避免子进程继承
阅读全文
摘要:1 UTF8转TUF16 UTF16 本系统单字节字符,字符串 #if defined(_WIN32) #include <windows.h> #include <stdio.h> #include <iostream> #include <string> #include <iostream>
阅读全文
摘要:#include <iostream>#include"FreeImage.h"bool SaveToFile(int m_originW,int m_originH, char* FileName, BYTE* pBuf, int nWidth, int nHeight){ FIBITMAP* b
阅读全文
摘要:使用高版本C++编译器编译旧的SDK的时候,SDK代码中会含有一些已经废弃的函数;如std::binary_function 修改方式: 原始代码: namespace { struct NameCompare: std::binary_function <const char *, const c
阅读全文
摘要:1,GetProcAddress只能加载与函数名一致的符号,如果是C++符号是无法加载函数的 所以在进行动态库加载时候,如果被加载的库是C++ 组件,需要将接口声明添加extern “C” 或者增加def文件; 否则会出现GetProcAddress加载动态函数时候失败; 2,查看动态库是否有符号可
阅读全文
摘要:常见c/C++ #include <windows.h> #include <iostream> DWORD WINAPI ThreadProc(LPVOID lpParam) { std::cout << "线程执行中,参数是: " << (int)lpParam << std::endl; re
阅读全文
摘要:1、wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) 宽字符版本主函数 hInstance (HINSTANCE): 这是一个句柄,指向当前应用程序的实例。当程序启动时,系统会
阅读全文
摘要:1如果你是release运行时出问题,很难复现请,参考我的这篇博客,在编译之初做好准备 https://www.cnblogs.com/8335IT/p/18079295 linux上编译release并剥离调试信息 配合gdb attach pid/c/break XXX.cpp:line No.
阅读全文
摘要:经常在网上看到“容器中删除的只要不是最后一个元素,循环就会崩溃” 其实不然,经过测试;容器中使用迭代器循环访问,只要删除迭代器所指元素后,继续for,不管你删除的是第一个还是最后一个,或者中间的某一个,只要不跳出来,就会崩溃; 首先,for循环,++或者--,都是在for循环体执行完一次后执行;所以
阅读全文
摘要:CLOCK_MONOTONIC(即monotonic time) CLOCK_MONOTONIC:以绝对时间为准,获取的时间为系统重启到现在的时间,更改系统时间对它没有影响。 字面意义:单调时间,表示系统启动后流逝的时间,由变量jiffies来记录的。 系统每次启动时,jiffies初始化为0。每来
阅读全文
摘要:// ConsoleA.cpp : 定义控制台应用程序的入口点。// #include "stdafx.h"#include<string>using namespace std;//ascii 0-9:48~57//A :65//a:97//空格不等于\0//单引号的空格和双引号的空格不一样,单引
阅读全文
摘要:VScode我们常用语创建跨平台项目,使用cmake编译;在编译的的时候我们经常用的命令入:【要先自己写cmakelists.txt】cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_AMC=on -B build cmake --build build -j8(多线程
阅读全文