随笔分类 -  C/C++

摘要:问题描述 vscode debug c++时,生成exe 放在指定地址,是在编译时设置(tasks.json中), debug时是在launch.json json 文件中的cwd 是设置执行命令时的 路径。 如果如果生成的exe,和 代码 不再同一个目录下,需要在launch.json中修改cwd 阅读全文
posted @ 2024-06-03 14:01 BISTER 阅读(330) 评论(0) 推荐(0)
摘要:问题描述 .cpp 和 .c 混合编程时,CMake 中添加了依赖的.c文件,头文件目录也添加了,但是会报error undefined reference to 函数。 需要在头文件中添加下面的代码,cmake 就可以编译pass,生成正确的exe。 #ifdef __cplusplus exte 阅读全文
posted @ 2024-06-03 12:47 BISTER 阅读(565) 评论(0) 推荐(0)
摘要:执行命令查看g++包含路径 vscode检测到#include错误,请更新includePath。解决方法_Kuany_的博客-CSDN博客_检测到include错误,请更新includepath g++ -v -E -x c++ - 阅读全文
posted @ 2023-03-15 16:55 BISTER 阅读(22) 评论(0) 推荐(0)
摘要:cmake_minimum_required (VERSION 3.9)#规定cmake的最低版本要求 INCLUDE(CMakeForceCompiler) CMAKE_FORCE_C_COMPILER(gcc GNU) CMAKE_FORCE_CXX_COMPILER(g++ GNU) proj 阅读全文
posted @ 2021-04-08 14:21 BISTER 阅读(25) 评论(0) 推荐(0)
摘要:智能指针 https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/magic/ 智能指针是一个通过重载 * 和 -> 运算符以表现得如指针一样的类. 智能指针类型被用来自动化所有权的登记工作, 来确保执行 阅读全文
posted @ 2021-04-08 14:20 BISTER 阅读(14) 评论(0) 推荐(0)
摘要:C++中引入了字符串类型,C里面使用字符数组表示字符串。 但是c语言中字符串以 '\0' 结束,但是C++不一定(由编译器决定)。 为什么C语言风格的字符串要以'\0'结尾,C++可以不要。 使用字符数组表示字符串时,往往需要的空间总比内部字符多一个,因为留一个 '\0' 的空间 参考:https: 阅读全文
posted @ 2021-04-08 14:18 BISTER 阅读(19) 评论(0) 推荐(0)
摘要:// 使用pandoc将md格式转为html void mdtohtml(string file,string filename){ // pandoc --standalone --self-contained API_First.md -f markdown -t html -o C:\User 阅读全文
posted @ 2021-04-08 14:15 BISTER 阅读(20) 评论(0) 推荐(0)
摘要:0x00 遇到的问题说明 1. 在ubuntu下安装任何包,出现下图错误,几经搜索终于找到原因,是因为禁止了Ubuntu自动更新导致的 解决办法:在软件安装界面启动 2. python安装pyqt5出现异常,问题如下所示 开始安装 1. 首先去官网下载在线安装包,如下图剪头标记文件,然后在命令行中直 阅读全文
posted @ 2021-04-08 14:11 BISTER 阅读(139) 评论(0) 推荐(0)
摘要:主函数,管理系统入口——StuManageMain.cpp /* 这是学生管理系统入口 g++ -g ManageStuSys.cpp StuManageMain.cpp -I ../inc -o ../bin/StuManageSys */ #include <iostream> #include 阅读全文
posted @ 2021-04-08 14:09 BISTER 阅读(14) 评论(0) 推荐(0)
摘要:C++获取、修改系统环境变量 #include <iostream> #include <stdlib.h> #include <Windows.h> using namespace std; // 获取环境变量getenv("变量名") int main(){ char* strenv; pute 阅读全文
posted @ 2020-04-27 21:35 BISTER 阅读(209) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <fstream> #include <vector> #include <io.h> using namespace std; //从jm文件中拷贝内容到另一个不jm文件,,注意不能通过程序读加密文件的内 阅读全文
posted @ 2020-04-27 18:06 BISTER 阅读(32) 评论(0) 推荐(0)
摘要:在网上查询很久资料,都是使用VS Studio的。 没有GCC环境下,使用C/C++连接mysql数据库的详细指导,查询资料后现总结如下: 首先,先将mysql 下的include文件夹复制到自己的工程下。同时将lib文件夹下的libmysql.dll libmysql.lib mysqlclien 阅读全文
posted @ 2020-04-25 21:39 BISTER 阅读(79) 评论(0) 推荐(0)
摘要:安装MinGW参考: https://blog.csdn.net/u013171283/article/details/80898442 安装过程中可能会出现下面两个文件错误 make-3.82.90-2-mingw32-cvs-20120902-bin.tar.lzma gdb-7.6.1-1-m 阅读全文
posted @ 2020-04-08 13:11 BISTER 阅读(19) 评论(0) 推荐(0)
摘要:string::find()函数:是一个字符或字符串查找函数,该函数有唯一的返回类型,即string::size_type,即一个无符号整形类型,可能是整数也可能是长整数。如果查找成功,返回按照查找规则找到的第一个字符或者子串的位置;如果查找失败,返回string::npos,即-1(当然打印出的结 阅读全文
posted @ 2020-04-08 10:34 BISTER 阅读(92) 评论(0) 推荐(0)
摘要:17.11 — C-style string symbolic constants – Learn C++ char* X= "ssss":X是指向存放 字符串常量 ssss的地址,可以直接使用char*变量修改该地址处的内容 char* ptr = "sssss1"; char ptrarray[ 阅读全文
posted @ 2020-04-03 15:43 BISTER 阅读(74) 评论(0) 推荐(0)
摘要:参考: https://blog.csdn.net/qq_36409711/article/details/78937137? https://blog.csdn.net/qq_27923041/article/details/83857964 服务端 #include <iostream> #in 阅读全文
posted @ 2020-03-31 12:08 BISTER 阅读(8) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/MrYuan/p/4800257.html 阅读全文
posted @ 2020-03-28 11:59 BISTER 阅读(5) 评论(0) 推荐(0)
摘要:字符串流stringstream #include <iostream> #include <stdexcept> #include <exception> #include <vector> #include <fstream> #include <sstream> using namespace 阅读全文
posted @ 2020-03-27 17:24 BISTER 阅读(10) 评论(0) 推荐(0)
摘要:函数名本质上就代表函数的首地址,数组名代表数组的首元素地址。 type (*ptr) (param) 函数指针 = 函数的指针,一个指针变量指向的地址存着一个函数. //定义一个函数 void fuc1(int a){ cout << "this is fuc1 define" << a <<end 阅读全文
posted @ 2020-03-23 21:54 BISTER 阅读(16) 评论(0) 推荐(0)
摘要:#include <iostream> #include <bitset> //输出二进制的头文件 using namespace std; int main(){ int a = 2149580819; cout << "八进制: " << oct << a << endl; cout << "十 阅读全文
posted @ 2020-03-07 13:59 BISTER 阅读(137) 评论(0) 推荐(0)