libssh放在linux哪个路径,致命错误:libssh2。h:没有这样的文件或目录

I'm by far no expert on C and even if the solution is righ there I can't see it. Have been trying this for 2 days now and I think I've given it my best.

到目前为止,我还不是C方面的专家,即使答案是肯定的,我也看不出来。我已经试了2天了,我想我已经尽力了。

Specs: Win7 x64, Compiler MinGW and CMake up and running

Win7 x64,编译器MinGW和CMake组成并运行

To use my compiler I issued in the downloaded folder in Desktop: cmake -G "MinGW Makefiles" After that, in the same folder I did: cmake --build .

为了使用我在Desktop: cmake -G“MinGW Makefiles”下载文件夹中发布的编译器,我在同一个文件夹中做了:cmake -build。

Ended up at 100% and what seems to me without any error:

结果是100%,在我看来没有任何错误:

[100%] Linking C executable test_keyboard_interactive_auth_fails_with_wrong_response.exe [100%] Build target test_keyboard_interactive_auth_fails_with_wrong_response

[100%]链接C可执行的test_keyboard_interactive_auth_fails_with__response。exe[100%]构建目标test_keyboard_interactive_auth_fails_with_wrong_response

Now my code is utterly simple, I just want to make it work but fails on the headers. I am following this tutorial http://api.libssh.org/master/libssh_tutorial.html and can't even make the first page work.

我的代码非常简单,我只是想让它工作,但是在头信息上失败了。我正在学习本教程http://api.libssh.org/master/libssh_tutorial.html,甚至连第一页都不能使用。

The headers I tried, that I can remember, are:

我试过的标题,我记得,是:

#include #include #include

# include < libssh2。h > # include < libssh / libssh。h > # include < libssh.h >

and I get "No such file or directory" for any of the headers.

我得到的“没有这样的文件或目录”任何头。

At home I managed to do something different: by adding the libssh.h library and its files manually to the folder I was working on and changing the headers to #include "libssh.h" After that I would not get that error but would raise a different one, something like "undefined reference to ssh_new" or something like that, can't remember now but can update on it later.

在家里,我设法做了一些不同的事情:添加libssh。h库和它的文件手动地保存到我正在处理的文件夹中,并将头文件更改为#include“libssh”。h"之后,我不会得到那个错误但会产生一个不同的错误,比如" ssh_new未定义引用"之类的,现在不记得了,但以后可以更新。

I would appreciate any help. I wouldnt mind compiling from Linux if its going to be easier but my target is to make an ssh server and a ssh client for windows (initially) and by myself - following that tutorial or another one.

我希望得到任何帮助。我不介意在Linux上编译,如果它会更容易的话,但是我的目标是为windows和我自己制作一个ssh服务器和一个ssh客户机(最初)——遵循那个教程或另一个教程。

Cheers everyone.

每个人的欢呼。

1 个解决方案

#1

0

Two problems:

两个问题:

Your compiler cannot find the header file - you probably didn't tell where to look for.

你的编译器找不到头文件-你可能没有告诉去哪里找。

You obviously do not link your program with libssh, that's why you get "undefined reference".

显然,您没有将程序链接到libssh,这就是为什么您会得到“未定义引用”。

You should tell your visual studio that it should look for header files in the include directory of the libssh installation and secondly, it should link your program with libssh.

您应该告诉visual studio,它应该在libssh安装的include目录中查找头文件,其次,它应该将您的程序与libssh连接起来。

There are a lot of ways how to get there, the most widespread ones are using a build system or generator like CMake (or any other out there - there are a lot!) but of course you can as well simply point your visual studio to the correct locations.

有很多方法可以到达那里,最普遍的方法是使用像CMake这样的构建系统或生成器(或者任何其他的——有很多!)但是当然,您也可以简单地将您的visual studio指向正确的位置。

If you use a library, you need access to the corresponding header files and you need to link to the library. The header files can be included with angle brackets (e.g. include ) if you tell your compiler that the folder is a system folder, otherwise you include them with quotes (e.g. include "myheader.h").

如果使用库,则需要访问相应的头文件,并需要链接到库。如果您告诉您的编译器该文件夹是一个系统文件夹,那么可以使用尖括号(例如,包含

)来包含头文件,否则您将使用引号(例如,包含"myheader.h")。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值