Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #define LIBSSH_STATIC 1
  4. #include <libssh/libssh.h>
  5. #include <stdlib.h>
  6.  
  7. void sftpSession()
  8. {
  9. ssh_session test_session = ssh_new();
  10. if (!test_session) {
  11. throw std::runtime_error("Could not create a session?!");
  12. return;
  13. }
  14. ssh_free(test_session);
  15. std::cout << "Session created & freed successfully." << std::endl;
  16. }
  17.  
  18. int main(int argc, char **argv)
  19. {
  20. std::cout << "SFTP test program" << std::endl;
  21. try {
  22. sftpSession();
  23. }
  24. catch (const std::runtime_error &e) {
  25. std::cout << "thrown: " << e.what() << std::endl;
  26. }
  27. return EXIT_SUCCESS;
  28. }
  29.  
  30. x86_64-w64-mingw32-g++.exe
  31. -Wall -fexceptions -O2 -std=c++0x -g -m64 -Dmine_dev=1
  32. -I"C:Program Fileszlibzlib-1.2.8-dllinclude"
  33. -I"C:Program Files (x86)libsshlibssh-0.6.5include"
  34. -c C:Users ... SFTP_testingmain.cpp
  35. -o objReleasemain.o
  36.  
  37. x86_64-w64-mingw32-g++.exe
  38. -L"C:Program Files (x86)IngresIngresIIingreslib"
  39. -o binReleaseSFTP_testing.exe
  40. objReleasemain.o
  41. -s
  42. "C:Program Files (x86)libsshlibssh-0.6.5liblibssh.dll.a"
  43.  
  44. objReleasemain.o: In function `sftpSession()':
  45. C:/Users/ ... /SFTP_testing/main.cpp:9: undefined reference to `ssh_new'
  46. C:/Users/ ... /SFTP_testing/main.cpp:14: undefined reference to `ssh_free'
  47. collect2.exe: error: ld returned 1 exit status
  48. Process terminated with status 1 (0 minute(s), 2 second(s))
  49. 3 error(s), 0 warning(s) (0 minute(s), 2 second(s))
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. ...
  55. LIBSSH_API ssh_session ssh_new(void);
  56. ...
  57. LIBSSH_API void ssh_free(ssh_session session);
  58. ...
  59. #ifdef __cplusplus
  60. }
  61. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement