Possible Duplicate:
Noobish, linker errors when compiling against glib…?
I have the following Makefile:
remote: RemoteCMD.o sshlib.o
g++ -L/usr/include/libssh -lssh RemoteCMD.o sshlib.o -o RemoteCMD
RemoteCMD.o: RemoteCMD.cpp
g++ -c RemoteCMD.cpp
sshlib.o: sshlib.cpp
g++ -c sshlib.cpp
sshlib.h includes libssh/libssh.h and sshlib.cpp includes sshlib.h. When made I get:
g++ -L/usr/include/libssh -lssh RemoteCMD.o sshlib.o -o RemoteCMD
sshlib.o: In function `ssh::connect(char*, char*)':
sshlib.cpp:(.text+0x1c): undefined reference to `ssh_new'
I also double check where libssh.a is:
$> whereis libssh.a
libssh: /usr/include/libssh
I've also tried -llibssh
and -llibssh.a
. Seems this guy has a very similar unanswered question, too.