【问题标题】:Trouble linking crypt in c++ project在 C++ 项目中链接 crypt 时遇到问题
【发布时间】:2013-04-22 20:20:52
【问题描述】:

我正在尝试使用GNU C library crypt 中包含的crypt() 方法。我已经看过这些类似的问题,123,但无法得到任何提供的解决方案。

我只是包括这两件事

#include <unistd.h>
#include <crypt.h>

编译器告诉我

hashtable.h:7:19: error: crypt.h: No such file or directory
make: *** [pass.x] Error 1

如何让编译器识别 crypt.h?

【问题讨论】:

标签: c++ c encryption crypt


【解决方案1】:

您的系统上安装了 crypt 吗?如果是,找到 crypt.h 的目录并将其添加到编译器的头文件搜索路径:-I/path/to/crypt/headers

您还需要使用 -lcrypt 链接到 crypt 库,可能会使用 -L 选项告诉链接器库在哪里。

在 OSX 上使用 crypt 的说明:Using crypt_r on OS X

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-06
    • 2012-11-19
    • 1970-01-01
    • 2017-11-17
    相关资源
    最近更新 更多