c++ - Tesseract baseapi 错误 : 'strncpy' :this function or variable may be unsafe. 考虑改用 strncpy_s

标签 c++ visual-studio ocr tesseract

当我在 Visual Studio 2012(我使用的是 C++)中使用以下代码时出现上述错误:

#include <tesseract\baseapi.h>

任何人都可以阐明可能出了什么问题吗?

最佳答案

默认情况下不推荐使用非安全 CRT 函数。您可以通过定义宏 _CRT_SECURE_NO_WARNINGS 重新启用它们。尝试-

#define _CRT_SECURE_NO_WARNINGS
#include <tesseract\baseapi.h>

或者将宏添加到项目属性列表中。阅读文章 Eliminating Deprecation Warnings在 MSDN。

来自文章-

There are several ways to eliminate deprecation warnings for the older, less secure functions. The simplest is simply to define _CRT_SECURE_NO_WARNINGS or use the warning pragma. Either will disable deprecation warnings, but of course the security issues that caused the warnings still exist. It is far better to leave deprecation warnings enabled and take advantage of the new CRT security features.

关于c++ - Tesseract baseapi 错误 : 'strncpy' :this function or variable may be unsafe. 考虑改用 strncpy_s,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22423925/

相关文章:

c++ - 使用嵌套类的奇怪 enable_if 行为(MSVC 编译器错误或功能?)

SQL 网络接口(interface),错误 : 26 - Error Locating Server

c# - 我需要 WPF 的 OCR

opencv - 训练 Tesseract 3 从煤气表的真实图像中识别数字

c++ - 相似数值类型的模板冲突

c++ - C++中的map数据结构是什么

C++ - "using"关键字说明

visual-studio - 如何更改Intellisense工具提示颜色

terminal - unicharset_extractor : command not found

c++ - 如何从 Vista 和 Windows 7 上的应用程序启动屏幕键盘