Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
520 views
in Technique[技术] by (71.8m points)

c++ - How to use libssh in VS10

How can I implement libssh as a library my compiler will recognize? I'm using Visual Studio 2010 C++, and I've included the Boost library with no problems, but the process I did with Boost is strange, I can tell libssh will be different.

I really don't want to do a DLL file, I want one executable, however I know that DLL files can be embedded inside of executables through .rc scripting. (Then extract and load)

I've never had to include a library except for Boost into any of my projects, I feel like I should really know how to do this. Please note this is libssh not libssh2. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Even if the post is old i have an answer, maybe it can be helpful for someone dropping here.

To implement libssh into Visual Studio 2010.

You will need more than just one library you will need 3 to be sure everything will compile well. First download the last version of libssh After this you will need 2 more dll, to be allow to compile without issue:

  • libeay32.dll
  • zlib1.dll

For the first one it wasn't recognize very well for me, so i just took the full library of openssl openssl-0.9.8k_WIN32.zip

After you have dowloaded those files place them into the rigth place in Visual studio.

go to

  • C:Program Files (x86)Microsoft Visual Studio 10.0VC

To open the visual studio for the language C -> VC Then :

  • Copy the folder with the include in C:Program Files (x86)Microsoft Visual Studio 10.0VCinclude paste the folder libsshinclude (containing all .h file)
  • Copy the file ssh.lib into C:Program Files (x86)Microsoft Visual Studio 10.0VClib
  • Copy ssh.dll C:Program Files (x86)Microsoft Visual Studio 10.0VCin

Copy libeay32.dll and zlib1.dll into the bin folder. Or if you downloaded openssl which I recommend then you just do the same proces ass for lib ssh just dont forget to copy also the .exe file into the bin folder with the dll.

It is not finished yet after that you'll have to link the libraries into the compiler of your project.

Project -> projectName properties a windows open with properties then go -> Configuration Properties -> Linker -> input -> Additional Dependencies.

Now add the following libraries into the dependencies

;ssh.lib;ssleay32.lib;libeay32.lib;

And then it was working very well

I hope that it can help someone dropping by here :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...