- 博客(24)
- 收藏
- 关注
原创 添加#define _CRT_SECURE_NO_WARNINGS 1(方法)
在Everything中搜索newc++file.cpp并用记事本打开,添加宏定义#define_CRT_SECURE_NO_WARNINGS1。该操作可使每次在VS中新建C++文件时自动包含这行代码,避免安全警告。方法简单有效,仅需5个步骤即可完成设置。
2026-03-17 17:47:07
176
原创 #pragma warning(disable:4996)
摘要:#pragma warning(disable:4996)是Visual Studio特有的预处理指令,用于禁用编号4996的警告(常见于scanf、strcpy等传统函数被标记为不安全的情况)。该指令适用于VS环境下需要兼容旧代码的场景,但不解决函数本身的安全性问题,且不适用于GCC/Clang编译器。替代方案包括使用C++标准流(cin/cout)或在项目设置中允许使用废弃函数。在小型项目或学习时可使用,生产环境建议采用更安全的实现方式。
2026-02-25 15:14:31
242
原创 #include<limits>#include <string>#include <sstream>#include <iomanip>
是 C++ 的 “输入 / 输出流格式控制” 头文件(i/o manipulators 的缩写),专门用于格式化控制台输出 / 输入的样式,比如设置小数位数、对齐方式、补零等。就是用这个类),以及字符串的各种操作(比如判断空字符串。类型,会报 “未定义标识符'string'” 的错误。类,实现 “字符串 ↔ 数值” 的双向转换。如果你不包含这个头文件,编译器不认识。提供 C++ 标准的。
2026-02-23 20:47:38
121
原创 cerr << 是C++中用于输出错误信息的标准用法
摘要:C++中cerr是标准错误输出流对象,用于输出错误和警告信息。与cout不同,cerr专用于非正常程序状态的信息提示。示例代码展示了如何使用cerr处理无效年龄输入:当年龄为负数时输出错误信息,当年龄过大时输出警告。正常输出仍使用cout,保持错误信息与常规输出的分离,符合良好的编程实践。
2026-02-19 22:36:19
338
原创 #define _CRT_SECURE_NO_WARNINGS 1
摘要:#define_CRT_SECURE_NO_WARNINGS1宏用于关闭Visual C++编译器对传统C函数(如scanf、strcpy等)的安全警告。该指令告知编译器不要提示"这些函数可能有安全隐患"的警告信息,使开发者可以继续使用这些传统函数而不会收到警告提示。通常在包含标准库头文件前定义该宏即可生效。
2026-02-19 22:21:15
457
原创 config = get_config().split()AttributeError: ‘NoneType‘ object has no attribute ‘split‘
config = get_config().split()AttributeError: 'NoneType' object has no attribute 'split'
2025-04-10 11:22:52
258
原创 ImportError: attempted relative import with no known parent package
from .searcher import *ImportError: attempted relative import with no known parent packagepython-BaseExceptionBackend Qt5Agg is interactive backend. Turning interactive mode on.
2025-03-27 15:59:32
3614
原创 python-BaseExceptionBackend Qt5Agg is interactive backend. Turning interactive mode on.
ImportError: cannot import name 'Solver' from partially initialized module 'solver.solver' (most likely due to a circular import) (E:\Study\graduation thesis\hrl_acra_main(1)\solver\solver.py)python-BaseExceptionBackend Qt5Agg is interactive backend.
2025-03-27 15:34:34
707
原创 Could not find a version that satisfies the requirement torch>=1.8.1
Could not find a version that satisfies the requirement torch>=1.8.1
2025-02-20 00:24:30
1949
原创 Install pytorch with cuda version.\n
Install pytorch with cuda version.\n./install.sh: line 37: conda: command not found./install.sh: line 44: pip: command not found./install.sh: line 48: conda: command not found
2025-02-20 00:14:43
423
原创 ModuleNotFoundError: No module named ‘torch_scatter‘
ModuleNotFoundError: No module named 'torch_scatter'
2025-02-19 22:35:15
1178
原创 错误:AttributeError: module ‘numpy‘ has no attribute ‘float‘.
AttributeError: module 'numpy' has no attribute 'float'.`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe.
2025-01-08 15:00:04
2225
2
原创 错误:ModuleNotFoundError: No module named ‘sklearn.datasets.samples_generator‘
错误:ModuleNotFoundError: No module named 'sklearn.datasets.samples_generator'
2025-01-08 14:53:30
747
原创 错误:FileNotFoundError: [Errno 2] No such file or directory: ‘science‘
FileNotFoundError: [Errno 2] No such file or directory: 'science'
2025-01-08 14:39:51
617
原创 Expression:result_pointer != nullptr 程序错误解决
(assertion)是一种运行时检查,用于验证程序中的某些条件是否为真。如果条件不满足,程序会触发断言失败,通常会导致。,则表示函数预期要返回一个有效的指针,但实际上没有得到有效的指针,这可能是由于内存分配失败或其他错误导致的。在这里,是由于scanf中没有使用 &n 来传递 n 的地址,所以程序可能会出现运行时错误,因为。运算符获取地址),以避免未定义行为和潜在的程序崩溃。试图向一个非法的或者未定义的内存地址写入数据。时总是传递变量的地址(对于基本数据类型,如。在C和C++编程中,
2024-06-08 10:25:58
1622
原创 关闭Typora每次启动时的已激活弹窗以及去除软件左下角“未激活”提示
按照安装路径,找到 resources\locales\zh-Hans.lproj\。1. 找到typora安装路径下的resources\page-dist\。然后重新打开Typora,之后就不会再出现。一、关闭Typora每次启动时的已激活弹窗。但是如果是最新版直接去掉会有一个报错,二、去除软件左下角“未激活”提示。
2024-06-06 21:06:38
16856
17
原创 LNK1168 无法打开 E:\warehouse\desire\6_6\x64\Debug\6_6.exe 进行写入
没有被关掉,把之前的程序关掉重新编译运行即可。
2024-06-06 20:34:13
482
原创 C4996 ‘scanf‘: This function or variable may be unsafe. Consider using scanf s instead.
解决C4996 'scanf': This function or variable may be unsafe. Consider using scanf s instead.
2024-06-02 18:19:18
557
原创 字符串未正确初始化或越界访问而产生随机值
s 是打印字符串,一定要找到\0,打印才停止。在C语言中,字符串是通过字符数组表示的,并。所以,可以在arr2数组中添加。
2024-05-31 18:47:26
226
原创 VS2022 监视窗口打开方法及使用
1.按ctrl+f10进入调试阶段如果没有监视窗口,打开方法如下:方法一:通过快捷键(这里面1234指的是监视窗口,打开任何一个即可)方法二:点击。
2024-05-31 18:14:06
4870
4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅