Subject: LIBSSH2-DEV C++ Integration issue [Linker error] undefined reference to `libssh2_

LIBSSH2-DEV C++ Integration issue [Linker error] undefined reference to `libssh2_

From: AL-AMEEN MUTHALIF <ameen_al_at_rediffmail.com>
Date: 10 Sep 2011 14:24:27 -0000

&nbsp;

Guys,

&nbsp;

I’m trying to &nbsp;integrate
libssh2 libraries(windows version libssh2-1.2.5) with Dev-C++( v4.9.9.2). The OS
is Windows XP &nbsp;SP3. I’m facing the following
error when I compile the test file ssh2_exec.c (built in example) file.

&nbsp;

Compiler Output:

---------------------

&nbsp; [Linker error]
undefined reference to `libssh2_session_block_directions'

&nbsp; [Linker error]
undefined reference to `select_at_20'

&nbsp; [Linker error]
undefined reference to `WSAStartup_at_8'

&nbsp; [Linker error]
undefined reference to `libssh2_init'

&nbsp; .

&nbsp; .

&nbsp; .

&nbsp; .

&nbsp; .

&nbsp; [Linker error]
undefined reference to `libssh2_session_free'

&nbsp; [Linker error]
undefined reference to `closesocket_at_4'

&nbsp; [Linker error]
undefined reference to `libssh2_exit'

&nbsp; ld returned 1 exit
status

C:\MyApps\libssh2\Makefile.win [Build Error]&nbsp; [cmdSSH.exe] Error 1

C:\MyApps\libssh2\Makefile.win [Build Error]&nbsp; [cmdSSH.exe] Error 1

&nbsp;

&nbsp;

Complier Log.

-----------------

Compiler: Default compiler

Building Makefile:
"C:\MyApps\libssh2\Makefile.win"

Executing&nbsp; make clean

rm -f ssh2_exec.o&nbsp;
cmdSSH.exe

gcc.exe -c ssh2_exec.c -o ssh2_exec.o
-I"C:/Dev-Cpp/include"&nbsp;
-I"C:/MyApps/libssh2-1.2.5/include"&nbsp;&nbsp;&nbsp;

gcc.exe ssh2_exec.o&nbsp;
-o "cmdSSH.exe" -L"C:/Dev-Cpp/lib"
-L"C:/MyApps/libssh2-1.2.5/lib"&nbsp;&nbsp;

ssh2_exec.o(.text+0xa1):ssh2_exec.c: undefined reference to
`libssh2_session_block_directions'

ssh2_exec.o(.text+0x10a):ssh2_exec.c: undefined reference to
`select_at_20'

ssh2_exec.o(.text+0x18d):ssh2_exec.c: undefined reference to
`WSAStartup_at_8'

ssh2_exec.o(.text+0x1e0):ssh2_exec.c: undefined reference to
`libssh2_init'

ssh2_exec.o(.text+0x222):ssh2_exec.c: undefined reference to
`inet_addr_at_4'

ssh2_exec.o(.text+0x244):ssh2_exec.c: undefined reference to
`socket_at_12'

ssh2_exec.o(.text+0x25c):ssh2_exec.c: undefined reference to
`htons_at_4'

ssh2_exec.o(.text+0x283):ssh2_exec.c: undefined reference to
`connect_at_12'

ssh2_exec.o(.text+0x2d5):ssh2_exec.c: undefined reference to
`libssh2_session_init_ex'

ssh2_exec.o(.text+0x300):ssh2_exec.c: undefined reference to
`libssh2_session_set_blocking'

ssh2_exec.o(.text+0x312):ssh2_exec.c: undefined reference to
`libssh2_session_startup'

ssh2_exec.o(.text+0x35c):ssh2_exec.c: undefined reference to
`libssh2_knownhost_init'

ssh2_exec.o(.text+0x38f):ssh2_exec.c: undefined reference to
`libssh2_knownhost_readfile'

ssh2_exec.o(.text+0x3aa):ssh2_exec.c: undefined reference to
`libssh2_knownhost_writefile'

ssh2_exec.o(.text+0x3c3):ssh2_exec.c: undefined reference to
`libssh2_session_hostkey'

ssh2_exec.o(.text+0x402):ssh2_exec.c: undefined reference to
`libssh2_knownhost_check'

ssh2_exec.o(.text+0x474):ssh2_exec.c: undefined reference to
`libssh2_knownhost_free'

ssh2_exec.o(.text+0x4bf):ssh2_exec.c: undefined reference to
`libssh2_userauth_password_ex'

ssh2_exec.o(.text+0x52b):ssh2_exec.c: undefined reference to
`libssh2_userauth_publickey_fromfile_ex'

ssh2_exec.o(.text+0x594):ssh2_exec.c: undefined reference to
`libssh2_channel_open_ex'

ssh2_exec.o(.text+0x5c0):ssh2_exec.c: undefined reference to
`libssh2_session_last_error'

ssh2_exec.o(.text+0x634):ssh2_exec.c: undefined reference to
`libssh2_channel_process_startup'

ssh2_exec.o(.text+0x6a0):ssh2_exec.c: undefined reference to
`libssh2_channel_read_ex'

ssh2_exec.o(.text+0x799):ssh2_exec.c: undefined reference to
`libssh2_channel_close'

ssh2_exec.o(.text+0x7c7):ssh2_exec.c: undefined reference to
`libssh2_channel_get_exit_status'

ssh2_exec.o(.text+0x804):ssh2_exec.c: undefined reference to
`libssh2_channel_get_exit_signal'

ssh2_exec.o(.text+0x844):ssh2_exec.c: undefined reference to
`libssh2_channel_free'

ssh2_exec.o(.text+0x86e):ssh2_exec.c: undefined reference to
`libssh2_session_disconnect_ex'

ssh2_exec.o(.text+0x879):ssh2_exec.c: undefined reference to
`libssh2_session_free'

ssh2_exec.o(.text+0x884):ssh2_exec.c: undefined reference to
`closesocket_at_4'

ssh2_exec.o(.text+0x8a4):ssh2_exec.c: undefined reference to
`libssh2_exit'

collect2: ld returned 1 exit status

make.exe: *** [cmdSSH.exe] Error 1

Execution terminated

&nbsp;

&nbsp;

Make File:

-------------

&nbsp;

# Project: cmdSSH

# Makefile created by Dev-C++ 4.9.9.2

&nbsp;

CPP&nbsp; = g++.exe

CC&nbsp;&nbsp; = gcc.exe

WINDRES = windres.exe

RES&nbsp; =

OBJ&nbsp; = ssh2_exec.o
$(RES)

LINKOBJ&nbsp; = ssh2_exec.o
$(RES)

LIBS =&nbsp;
-L"C:/Dev-Cpp/lib"
-L"C:/MyApps/libssh2-1.2.5/lib"&nbsp;&nbsp;

INCS =&nbsp;
-I"C:/Dev-Cpp/include"&nbsp;
-I"C:/MyApps/libssh2-1.2.5/include"

CXXINCS =&nbsp;
-I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"&nbsp;
-I"C:/Dev-Cpp/include/c++/3.4.2/backward"&nbsp; -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"&nbsp;
-I"C:/Dev-Cpp/include/c++/3.4.2"&nbsp; -I"C:/Dev-Cpp/include"&nbsp; -I"C:/MyApps/libssh2-1.2.5/include"

BIN&nbsp; = cmdSSH.exe

CXXFLAGS = $(CXXINCS)&nbsp;

CFLAGS = $(INCS)&nbsp;&nbsp;

RM = rm -f

&nbsp;

.PHONY: all all-before all-after clean clean-custom

&nbsp;

all: all-before cmdSSH.exe all-after

&nbsp;

&nbsp;

clean: clean-custom

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${RM}
$(OBJ) $(BIN)

&nbsp;

$(BIN): $(OBJ)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(CC)
$(LINKOBJ) -o "cmdSSH.exe" $(LIBS)

&nbsp;

ssh2_exec.o: ssh2_exec.c

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(CC)
-c ssh2_exec.c -o ssh2_exec.o $(CFLAGS)

&nbsp;

&nbsp;

Can someone help me to resolve the issue?

&nbsp;

&nbsp;

&nbsp;

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-09-10