随笔分类 -  C++

摘要:方法 一: win32-msvc* { QMAKE_CXXFLAGS += /source-charset:utf-8 /execution-charset:utf-8 } 代码是在一个 Qt 项目文件(通常是以 .pro 扩展名结尾的文件)中使用的,用于指定在使用 MSVC 编译器时的特定编译选项 阅读全文
posted @ 2024-02-21 16:52 SusieSnail_SUN 阅读(203) 评论(0) 推荐(0) 编辑
摘要:例子一: #include <iostream> // 递归终止函数 void print() { std::cout << std::endl; } // 递归函数模板,打印第一个参数并递归打印剩余参数 template <typename T, typename... Args> void pr 阅读全文
posted @ 2024-01-12 11:23 SusieSnail_SUN 阅读(70) 评论(0) 推荐(0) 编辑
摘要:两种不同机制的回调函数 1. typedef void (*CallbackFunction)(int); 这个语句使用了指向函数的指针来定义回调函数类型。它表示一个接受一个`int`类型参数并且不返回任何值的函数指针类型。 这种方式是C风格的函数指针,它可以用来定义简单的函数指针类型,但是在复杂的 阅读全文
posted @ 2024-01-10 12:04 SusieSnail_SUN 阅读(23) 评论(0) 推荐(0) 编辑
摘要:参见 How to setup Qt and openCV on Windows - Qt Wiki QT + OPENCV + OpenCV_contrib + MINGW编译_东方.既白的博客-CSDN博客 基本操作参见其他的博客; 主要记录 更改了cmake、opencv、qt 多个版本均没有 阅读全文
posted @ 2023-11-04 15:33 SusieSnail_SUN 阅读(129) 评论(0) 推荐(0) 编辑
摘要:参照 Visual Studio 2022 查看类关系图_vs2022查看类图_code bean的博客-CSDN博客 阅读全文
posted @ 2023-11-03 14:52 SusieSnail_SUN 阅读(320) 评论(0) 推荐(0) 编辑
摘要:要将QStringList转换为string,可以使用QStringList的join()函数将所有的QString连接成一个字符串。例如: ```cpp QStringList list; list << "Hello" << "World"; QString str = list.join(" 阅读全文
posted @ 2023-09-18 08:39 SusieSnail_SUN 阅读(773) 评论(0) 推荐(0) 编辑
摘要:Analyser* Analyser::Instance() { static QMutex mutex; static QScopedPointer<Analyser> inst; if (Q_UNLIKELY(!inst)) { mutex.lock(); if (!inst) { inst.r 阅读全文
posted @ 2023-09-15 12:06 SusieSnail_SUN 阅读(6) 评论(0) 推荐(0) 编辑
摘要:CRLF、LF和CR是与文本文件中换行符有关的术语。 CRLF:CRLF代表回车(CR,Carriage Return)和换行(LF,Line Feed),是一种常见的换行符序列。在许多操作系统中,如Windows,文本文件中的换行通常由回车符和换行符组成,即"\r\n"。这种换行符序列告诉操作系统 阅读全文
posted @ 2023-09-14 21:24 SusieSnail_SUN 阅读(1028) 评论(0) 推荐(0) 编辑
摘要:#include <QXmlStreamReader> #include <QFile> #include <QDebug> int main() { QFile file("example.xml"); if (!file.open(QFile::ReadOnly | QFile::Text)) 阅读全文
posted @ 2023-09-13 17:01 SusieSnail_SUN 阅读(150) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <vector> #include <string> #include <algorithm> int main() { std::vector<std::string> myVector; // 创建一个空的vector<string> s 阅读全文
posted @ 2023-08-29 10:39 SusieSnail_SUN 阅读(15) 评论(0) 推荐(0) 编辑
摘要:OpenCV/opencv_contrib国内快速下载 | 绕云技术笔记 (raoyunsoft.com) 阅读全文
posted @ 2023-07-26 17:07 SusieSnail_SUN 阅读(186) 评论(0) 推荐(0) 编辑
摘要:#pragma once 指令和 #ifndef 指令 都是用于避免头文件的重复包含,但它们有一些区别和注意事项。 1. 功能区别:- #pragma once:这是一个非标准的预处理指令,它告诉编译器只包含一次当前的头文件。这是一种简单方便的方式,可以避免头文件的多次包含。大多数编译器都支持这个指 阅读全文
posted @ 2023-07-22 10:41 SusieSnail_SUN 阅读(142) 评论(0) 推荐(0) 编辑
摘要:_MSC_VER: 是 Microsoft Visual C++ 编译器的一个预定义宏,用于表示编译器的版本号。_MSC_VER 的值是一个整数,表示编译器的主要版本号。例如,_MSC_VER 的值为 1920 表示使用的是 Visual Studio 2019 版本。在条件编译中,可以使用 _MS 阅读全文
posted @ 2023-07-21 17:15 SusieSnail_SUN 阅读(38) 评论(0) 推荐(0) 编辑
摘要:采用了深拷贝的方式,obj2 和 obj3 的 data 成员变量指向不同的内存空间,因此可以独立地释放资源而不会出现重复释放的问题. class MyClass { public: int* data; int size; // 默认构造函数 MyClass() : data(nullptr), 阅读全文
posted @ 2023-07-19 14:50 SusieSnail_SUN 阅读(14) 评论(0) 推荐(0) 编辑
摘要:class MyClass { public: int* data; // 默认构造函数 MyClass() : data(nullptr) {} // 拷贝构造函数(浅拷贝) MyClass(const MyClass& other) : data(other.data) {} // 移动构造函数 阅读全文
posted @ 2023-07-19 12:41 SusieSnail_SUN 阅读(14) 评论(0) 推荐(0) 编辑
摘要:创建了一个名为MyClass的类,并在其中实现了默认构造函数、参数化构造函数、拷贝构造函数、移动构造函数、析构函数、拷贝赋值运算符、移动赋值运算符、成员函数、静态成员函数和友元函数。在主函数中,我们创建了几个类对象,并演示了这些函数的调用和使用。请注意,输出语句被添加到每个函数的实现中,以便在调用时 阅读全文
posted @ 2023-07-19 12:29 SusieSnail_SUN 阅读(21) 评论(0) 推荐(0) 编辑
摘要:1. 准备调试通过 没有bug的项目; 2. 在QT项目中,使用release进行调试。 3. 然后点击运行,在release目录下生成.exe文件。 4. release调试目录一般有两种,查看“项目”中的“概要”可以找到release的路径 5. release目录如下 6. 新建一个目标文件夹 阅读全文
posted @ 2023-04-24 14:38 SusieSnail_SUN 阅读(89) 评论(0) 推荐(0) 编辑
摘要:1 . auto daily_logger = spdlog::daily_logger_mt("daily_logger", "logs/daily.txt", 2, 30); 上面的auto 指的是 :std::shared_ptr<spdlog::logger> 2. spdlog安装生成 输 阅读全文
posted @ 2022-10-26 14:45 SusieSnail_SUN 阅读(389) 评论(0) 推荐(0) 编辑
摘要:1. 下载 spdlog 地址:github:https://github.com/gabime/spdlog git clone 至本地文件夹 D:\git\codeClone; 文件夹名为:spdlog-1 2. 安装spdlog (window版本) 准备工作(cmake 安装) 安装步骤: 阅读全文
posted @ 2022-10-14 16:44 SusieSnail_SUN 阅读(292) 评论(0) 推荐(0) 编辑
摘要:下载地址 https://github.com/nlohmann/json/tree/develop/single_include/nlohmann/json.hpp 引入工程 json.hpp是源文件包含了所有的函数,引入头文件在 .cpp文件即可; json.hpp 文件的目录是项目工程 inc 阅读全文
posted @ 2022-10-11 16:16 SusieSnail_SUN 阅读(1654) 评论(0) 推荐(0) 编辑

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