c++ - 安装 libssh2 时未创建 libssh2_config.h

标签 c++ ubuntu libssh2

标题或多或少描述了我在我的 Ubuntu 机器上遇到的问题。 按照说明中的说明,我按照以下步骤安装 libssh2:

./配置 制作 进行检查(所有 3 个测试均通过) sudo make install(由于权限问题,我必须使用 sudo)

然后我尝试使用 libssh2 页面中给出的一些示例,它们都具有以下内容:

#include "libssh2_config.h"

没有找到。在 usr/local/include 中创建了以下 3 个文件:

libssh2.h
libssh2_publickey.h
libssh2_sftp.h

我做错了什么吗?

谢谢!

最佳答案

我仍然无法弄清楚为什么没有创建文件,但这并不是真正必要的,因为删除了以下#ifdefs:

#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

并简单地将(在 linux 上)替换为:

#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>

以及删除代码中其余的#ifdefs 解决了这个问题。

关于c++ - 安装 libssh2 时未创建 libssh2_config.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19288277/

相关文章:

c++ - 各种类型的容器 - C++

c++ - Qt:按值将自定义对象存储在集合中

php - 如何在 ubuntu 中将 SOLR 从正常的 8983 端口移动到 Apache Tomcat 7 服务器?

PHP ssh2_shell 执行命令并获得响应

c++ - 找不到 libtoolize 和 glibtoolize

c++ - Visual C++ 2012 中的编译器错误? (乱七八糟的跳转地址)

c++ - 将 Boost successic_shortest_path_nonmale_weights() 与捆绑属性结合使用

ruby - 通过 nohup 运行 ruby​​ 脚本时,为什么不写入 nohup.out

ruby-on-rails - 将 Rails 应用程序部署到 Openshift : rhc - Username or password is not correct

windows - 为什么 LibSSH2 ssh2_exec 示例崩溃?