How to link libssh library in Makefile

I get following error, when i tried to compile my test program

g++     main.cpp   -o main
/tmp/ccICBwKO.o: In function `main':
main.cpp:(.text+0xa): undefined reference to `ssh_new'
main.cpp:(.text+0x2d): undefined reference to `ssh_free'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1

In my make file i have:

all:        main

$main:  main.cpp
        g++ main.cpp -o main -lssh

Thanks for help. (I really hate C/C++…)


Source: c++

Leave a Reply