c - 用于窗户
问题描述
我在我的 c 程序中使用 strlcpy、strlcat、strtok_r 函数。当我编译它时,我得到了
undefined reference to `strlcpy', undefined reference to `strlcat', undefined reference to `strtok_r'
我用谷歌搜索,发现我需要使用<bsd/string.h>
. 但我发现资源仅用于为 linux 安装 libbsd。
谁能告诉我如何为 Windows 安装 bsd
解决方案
不幸的是,目前还没有 libbsd 到 Windows 的官方端口。您的选择是:
strl*
用标准化(但有些劣质)strn*
函数(如strncpy
,strncat
)替换非标准函数strl*
用 Windows 的非标准_s
函数(如strcpy_s
,strcat_s
,strtok_s
)替换非标准函数libbsd-minimal
安装声称适用于 Windows的非官方软件包(未经测试)- 根据这个对 libbsd 的长期拉取请求,您自己在 MinGW 上构建和安装 libbsd
很可能,(2)让您最接近(基于 API 相似性),但可能需要您添加一些特定于平台的宏或实用程序代码以保持可移植性。
推荐阅读
- spring - 当 AspectJExpressionPointcutAdvisor 以编程方式创建时不会触发切入点
- python - 如何将库模块从另一个模块导入我的命名空间?
- encoding - 如何在 Weblogic 12c 控制台中打印 UTF-8 字符?
- laravel - 将 Laravel 项目推向 digitalocean
- asp.net-core - OpenIddict 无法使用 Cosmos 作为数据库,因为支持 ETag 并发
- python - Python Selenium 无法打开文件以标记为存储预留
- sql - 将 DD/MM/YYYY 格式转换为 YYYY-MM-DD
- c# - 如何通过 EF LINQ 展平记录获取但如果存在重复则仅按字段优先级获取一条记录
- python - 将文件、目录及其子项转换为对象
- material-ui - 未找到模块:错误:无法解析“@material-ui/icons/Facebook”。这是不同的