linker error with tcp sockets code :-(

Can anyone tell me where I’m going wrong please…

My code compiles and runs on SGI IRIX.
It compiles but fails to link on QNX.



My makefile for QNX says…


default: transmit

tcp.o: tcp.cpp tcp.h
cc -c tcp.cpp

transmit.o: transmit.cpp tcp.h
cc -c transmit.cpp

transmit: transmit.o tcp.o
cc -o transmit tcp.o transmit.o -lsocks


and the linker says…


cc -o transmit tcp.o transmit.o -lsocks
tcp.o: In function tcpGetAddress(char *)': tcp.o(.text+0xec): undefined reference to gethostbyname’
tcp.o: In function tcpSend(int, unsigned char *, unsigned int)': tcp.o(.text+0x16b): undefined reference to send’
tcp.o: In function tcpReceive(int, unsigned char *, unsigned int)': tcp.o(.text+0x1eb): undefined reference to recv’
tcp.o: In function tcpConnect(char *, unsigned int)': tcp.o(.text+0x2e0): undefined reference to socket’
tcp.o(.text+0x316): undefined reference to connect' tcp.o: In function tcpListen(unsigned int)’:
tcp.o(.text+0x372): undefined reference to socket' tcp.o(.text+0x3f2): undefined reference to bind’
tcp.o(.text+0x445): undefined reference to listen' tcp.o(.text+0x47c): undefined reference to accept’
tcp.o(.text+0x490): undefined reference to h_errno' tcp.o(.text+0x4af): undefined reference to h_errno’
/x86/usr/lib/libsocks.so: undefined reference to gethostbyaddr' /x86/usr/lib/libsocks.so: undefined reference to res_init’
/x86/usr/lib/libsocks.so: undefined reference to _res' /x86/usr/lib/libsocks.so: undefined reference to inet_ntoa’
/x86/usr/lib/libsocks.so: undefined reference to getservbyport' /x86/usr/lib/libsocks.so: undefined reference to rresvport’
/x86/usr/lib/libsocks.so: undefined reference to herror' /x86/usr/lib/libsocks.so: undefined reference to getservbyname’
/x86/usr/lib/libsocks.so: undefined reference to getnetbyname' /x86/usr/lib/libsocks.so: undefined reference to getsockname’
cc: /usr/ntox86/bin/ld error 1
make: *** [transmit] Error 1


Thanks in advance,
Gary.

\

Gary Quinn, VR Centre Technical Manager
University of Teesside SG Network Admin
Borough Road, Middlesbrough Go Player
Cleveland, TS1 3BA mailto:Gary@tees.ac.uk
+44 (0)1642 384303 fax 384310 http://vr.tees.ac.uk

Gary Quinn <Gary@tees.ac.uk> wrote:

Can anyone tell me where I’m going wrong please…

My code compiles and runs on SGI IRIX.
It compiles but fails to link on QNX.



My makefile for QNX says…



default: transmit

tcp.o: tcp.cpp tcp.h
cc -c tcp.cpp

transmit.o: transmit.cpp tcp.h
cc -c transmit.cpp

transmit: transmit.o tcp.o
cc -o transmit tcp.o transmit.o -lsocks

cc -o transmit tcp.o transmit.o -lsocket

-xtang

Many Thanks.

Gary :slight_smile:



Xiaodan Tang wrote:

Gary Quinn <> Gary@tees.ac.uk> > wrote:

Can anyone tell me where I’m going wrong please…

My code compiles and runs on SGI IRIX.
It compiles but fails to link on QNX.

My makefile for QNX says…

default: transmit

tcp.o: tcp.cpp tcp.h
cc -c tcp.cpp

transmit.o: transmit.cpp tcp.h
cc -c transmit.cpp

transmit: transmit.o tcp.o
cc -o transmit tcp.o transmit.o -lsocks

cc -o transmit tcp.o transmit.o -lsocket

-xtang

Gary Quinn, VR Centre Technical Manager
University of Teesside SG Network Admin
Borough Road, Middlesbrough Go Player
Cleveland, TS1 3BA mailto:Gary@tees.ac.uk
+44 (0)1642 384303 fax 384310 http://vr.tees.ac.uk