随笔分类 - C/C++一些笔记
摘要:# Simple Example ```C++ #include #include #include void print(std::string prefix, int number) { std::cout numbers; for (int i = 0; i #include #include
阅读全文
摘要:```C++ #include int main(const int argc, const char* argv[]) { std::string strSql1 = "select * from table \ where id = 1 \ and name='name'"; std::cout
阅读全文
posted @ 2023-06-30 14:27
dilex
摘要:1 #include <iostream> 2 #include <vector> 3 #include <boost/algorithm/string.hpp> 4 5 int main(const int argc, const char* argv[]) 6 { 7 std::vector<s
阅读全文
摘要:代码如下: 1 #include <map> 2 #include <iostream> 3 using namespace std; 4 5 namespace mapext 6 { 7 template <class T> 8 struct type_traits 9 { 10 typedef
阅读全文
摘要:开发Qt程序的时候,时常要从Qt库中继续某个类,并在自定义的子类使用到 Q_OBJECT 这个宏。如果是在QtCreator中开发,当时不会遇到问题,因为QtCreator已自动实现了很多功能,这也会导致开始过程对Qt底层原理的理解。 在这里写一个MyWidget类继承Qt库中的Widget类,相关
阅读全文
摘要:编译与安装Boost_1.69.0 到Boost官网下载 boost_1_69_0.zip 下载Boost_1.69.0 把下载的 boost_1_69_0.zip 解压到 E:\source\boost_1_69_0 下; 编译Boost_1.69.0 执行其下的脚本文件bootstrap.bat
阅读全文
摘要:Socket网络编程之echo服务器 这是Windows下的Socket编程例程: CMakeLists.txt #CMakeLists.txt cmake_minimum_required(VERSION 3.0) project(select) link_libraries(ws2_32) FI
阅读全文
posted @ 2021-03-14 15:37
dilex
摘要:什么是函数指针 函数指针:如果在程序中定义了一个函数,那么在编译时系统就会为这个函数代码分配一段存储空间,这段存储空间的首地址称为这个函数的地址。 函数指针变量定义形式 函数返回值类型 (*函数指针变量名) (函数参数列表); 如何用函数指针调用函数 int max(int x, int y); /
阅读全文
摘要:类的实例调用成员函数的原理 其实不管是通过对象实例或指针实例调用,其实底层调用的过程都是一样的,都是把当前对象的指针作为一个参数传递给被调用的成员函数。通过下面的相关实例代码进行检验: 实验的C++代码 class Student { private: int age; public: Studen
阅读全文
摘要:在vector中的emplace_back函数, 其效率比push_back高很多! /*例子中使用的Student类的声明*/ class Student { private: int age; public: Student(); explicit Student(int age); ~Stud
阅读全文
摘要:实践代码: git clone https://github.com/dilexliu/learn_qt5.git Step1: Qt设计器绘制窗口 保存会得到一个文件: mainwindow.ui 另外还需要把mainwindow.ui 的代码保存出来,操作:在Qt设计器中的菜单栏【窗体】->【查
阅读全文
摘要:编译前的工作 在编译libpng前,需要把zlib编译好,并加载到编译环境里。 CMake + VS2015 下编译zlib,及使用小例 下载与解压 libpng的官网是 http://www.libpng.org/pub/png/libpng.html ,但它的源码是存在 https://sour
阅读全文
摘要:自己使用的命令 原理 生成文件命名规则:boost中有许多库,有的库需要编译、而有的库不需要编译,只需包含头文件就可以使用。编译生成的文件名字普遍较长,同一个库根据编译链接选项不同,又可以生成多个不同名字的文件。生成的文件名字是很长,可是这样带的信息才多,也就容易识别出用途。其实生成文件的名字遵循一
阅读全文
摘要:安装工具 Python 这个安装的时候没记录下来,网上查一下,大把, 就不补了。 ActivePerl https://www.cnblogs.com/dilex/p/10591579.html 下载 http://download.qt.io/archive/qt/ 链接:https://pan.
阅读全文
摘要:Qt5的编译 Windows下载编译Qt5 Gui CMakeLists.txt 源码 main.cpp 源码
阅读全文
摘要:问题 一直都有一个问题,就是基于Windows下使用CMake构建VS工程时,CMake是如何查找到第三方库所在的路径的呢? 答案 今天重新想起这个问题,就拿构建Vtk的VS工程测试了一下, 才发现是通过系统的环境变量查找到第三方库所在的路径的,再通过库中的cmake配置文件,设置include的路
阅读全文
摘要:应用场景: 在后端服务器项目开发中,需要初始化一个Socket服务器,需要IP地址与对应端口号等参数;另外还可能因为对接数据库,就还需要数据库的相关配置参数,如我使用的是MySql数据库,就需要数据库服务器的IP地址、端口号、用户名与密码,还有数据库的名称。如若这些配置信息直接写到代码里,就会给后期
阅读全文
摘要:源码: #include <boost/program_options.hpp> namespace po = boost::program_options; int main(int argc, char** argv) { int compression = -1; po::options_de
阅读全文
摘要:#include #include #include #include using namespace std; #include #include void accept_cb(int fd, short events, void* arg); void socket_read_cb(bufferevent* bev, void* arg); void event_cb(st...
阅读全文

浙公网安备 33010602011771号