Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define LIBSSH_STATIC 1
- #include <libssh/libssh.h>
- #include <stdlib.h>
- void sftpSession()
- {
- ssh_session test_session = ssh_new();
- if (!test_session) {
- throw std::runtime_error("Could not create a session?!");
- return;
- }
- ssh_free(test_session);
- std::cout << "Session created & freed successfully." << std::endl;
- }
- int main(int argc, char **argv)
- {
- std::cout << "SFTP test program" << std::endl;
- try {
- sftpSession();
- }
- catch (const std::runtime_error &e) {
- std::cout << "thrown: " << e.what() << std::endl;
- }
- return EXIT_SUCCESS;
- }
- x86_64-w64-mingw32-g++.exe
- -Wall -fexceptions -O2 -std=c++0x -g -m64 -Dmine_dev=1
- -I"C:Program Fileszlibzlib-1.2.8-dllinclude"
- -I"C:Program Files (x86)libsshlibssh-0.6.5include"
- -c C:Users ... SFTP_testingmain.cpp
- -o objReleasemain.o
- x86_64-w64-mingw32-g++.exe
- -L"C:Program Files (x86)IngresIngresIIingreslib"
- -o binReleaseSFTP_testing.exe
- objReleasemain.o
- -s
- "C:Program Files (x86)libsshlibssh-0.6.5liblibssh.dll.a"
- objReleasemain.o: In function `sftpSession()':
- C:/Users/ ... /SFTP_testing/main.cpp:9: undefined reference to `ssh_new'
- C:/Users/ ... /SFTP_testing/main.cpp:14: undefined reference to `ssh_free'
- collect2.exe: error: ld returned 1 exit status
- Process terminated with status 1 (0 minute(s), 2 second(s))
- 3 error(s), 0 warning(s) (0 minute(s), 2 second(s))
- #ifdef __cplusplus
- extern "C" {
- #endif
- ...
- LIBSSH_API ssh_session ssh_new(void);
- ...
- LIBSSH_API void ssh_free(ssh_session session);
- ...
- #ifdef __cplusplus
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement