1

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.

Community
  • 1
  • 1
vlad417
  • 313
  • 1
  • 3
  • 10
  • 3
    Libraries at the end. See http://stackoverflow.com/questions/9966959/noobish-linker-errors-when-compiling-against-glib/9966989#9966989 – hmjd Dec 04 '12 at 16:42
  • .....thanks! Make it an answer, and I'll accept – vlad417 Dec 04 '12 at 18:04
  • Don't know if this helps someone else... Still I had some problem, -llibssh at the end gave me "cannot find -llibssh" Much trail and error, gave me this line. g++ -I/usr/include/libssh test.cpp -o test.o -lssh – volt Jan 05 '14 at 17:55

0 Answers0