随笔分类 - c/c++
摘要:test1.cpp源码如下: #include <stdio.h> #include <libxl.h> using namespace libxl; int main() { Book* book = xlCreateBook(); if(book) { Sheet* sheet = book->
阅读全文
摘要:{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https:
阅读全文
摘要:其中,有两个单独的部分-Wl和-rpath组成。 -Wl 这个是gcc的参数,表示编译器将后面的参数传递给链接器ld。 -rpath 大体就以下这几个意思: 1. 添加一个文件夹作为运行时库的搜索路径。在将ELF可执行文件与共享对象链接时使用此选项; 2. 在链接时,一些动态库明确的链接了其他动态库
阅读全文
摘要:#include <cassert> /** * Cast one size of int down to another one. * Asserts that no precision is lost at runtime. */ template<typename Small, typenam
阅读全文
摘要:// A macro to disallow the copy constructor and operator= functions #ifndef DISALLOW_COPY_AND_ASSIGN #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ Type
阅读全文
摘要:功能:将一个文件内容为"aa bb cc dd ee ff"等大量数据的文件转换为aabbccddeeff的文件中。测试源文件为all_send.txt. C语言源代码如下: #include <stdio.h>#include <string.h>int main(int argc, char *
阅读全文
摘要:Corrupt JPEG data: 1 extraneous bytes before marker 0xd9 JPEG datastream contains no image 对比发送时的全部数据如下(17207字节),跟对端收到时数据一致,但是对端解析时,却把数据部分替换了一些 ff d8
阅读全文
摘要:OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /home/program/opencv-3.2.0/m
阅读全文
摘要:发送数据如下: aa 02 02 00 00 00 6f 6b 02 00 00 00 55 数据是以字符数组的形式(char msg[])存储发送的,send时发送长度填写的strlen(msg), 导致发送的数据长度只有3, 打印出来是"aa 02 02". 也就是说16进制0x00后面的数据被
阅读全文
摘要:socket通信示例中,当accept客户端时,经常报这个错误。 并且是第一次没有问题,第二次或后面几次都会出现如下问题, 错误码为22, 错误描述为invalid argument. 问题解决如下: 在获取客户端socket fd时,每次都初始化客户端的sockaddr_in结构体, sockad
阅读全文
摘要:写了一个简单的boost测试程序,编译时出现如下错误: g++ -std=c++11 test_ssl.cpp -o test -lboost_system -lboost_thread/usr/bin/ld: /tmp/ccHdMo8P.o: undefined reference to symb
阅读全文
摘要:编译错误如下: g++ -std=c++11 tcp_session.cpp tcp_server.cpp test.cpp -o test -pthread/tmp/ccv4rZkD.o: In function `__static_initialization_and_destruction_0
阅读全文
摘要:方案一: 基于iw源程序,使用类似于 iw dev wlan0 scan的命令方式进行代码裁剪。 方案二“ 基于wpa_supplicant中 的wpa_cli命令,使用类似于 wpa_cli -i wlan0 scan_result的命令方式进行代码裁剪。
阅读全文
摘要:将C语言转换为C++代码时,发生如下错误 sorry, unimplemented: non-trivial designated initializers not supported。 查找原因,是因为C++结构体初始化时,必须按照定义的顺序进行初始化,不能够跳过其中内容而初始化其他选项,或者定义
阅读全文
摘要:问题: t->package().ship_id(sqlRow[1]);其中 ship_id为 结构体package中的string类型。如下:typedef struct Package{ string ship_id; ....}Package_t; 给ship_id赋值时报错: no matc
阅读全文
摘要:常用的宏定义有: 1) 对cpu集进行初始化, 将其设置为空集 void CPU_ZERO(cpu_set_t *set); 2) 将指定的cpu加入到cpu集中 void CPU_SET(int cpu, cpu_set_t *set); 3) 将指定的cpu从集中删除 void CPU_CLR(
阅读全文
摘要:visual studio code 中使用跳转到定义处的插件 https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync 或在安装处(ctrl + p)中输入如下: ext install Shan.cod
阅读全文
摘要:今天下载了开源程序“贪吃蛇” (github地址 : https://github.com/taylorconor/tinytetris.git) 在编译时,出现如下错
阅读全文
摘要:1、facebook的c++开源库folly(Facebook open source library)介绍 https://github.com/facebook/folly 2、pprint 一个让输出变得更漂亮的 C++ 库。 https://github.com/p-ranav/pprint
阅读全文
摘要:在.vscode文件夹下,添加如下文件 1) launch.json 内容如下 { "version": "0.2.0", "configurations": [ { "name": "launch", "type": "cppdbg", // 调试程序类型为c++ "request": "laun
阅读全文

浙公网安备 33010602011771号