C++ Network Programming

balaji

Registered
Hi Guys,

I am trying to compile a simple network programming example:-

#include <sys/types.h>
#include <sys/socket.h>


using the following libraries:-

g++ Download.cpp -lnsl -lsocket -lresolv

I have attached the verbose error messages:-

Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
/usr/libexec/gcc/darwin/ppc/3.3/cc1plus -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1495 -D__DYNAMIC__ Download.cpp -D__GNUG__=3 -fPIC -quiet -dumpbase Download.cpp -auxbase Download -version -D__private_extern__=extern -o /var/tmp//cccki6TL.s
GNU C++ version 3.3 20030304 (Apple Computer, Inc. build 1495) (ppc-darwin)
compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/gcc/darwin/3.3/c++
/usr/include/gcc/darwin/3.3/c++/ppc-darwin
/usr/include/gcc/darwin/3.3/c++/backward
/usr/local/include
/usr/include/gcc/darwin/3.3
/usr/include
End of search list.
Framework search starts here:
/System/Library/Frameworks
/Library/Frameworks
End of framework search list.
/usr/libexec/gcc/darwin/ppc/as -arch ppc -o /var/tmp//ccek5Tbt.o /var/tmp//cccki6TL.s
ld -arch ppc -dynamic -o a.out -lcrt1.o -lcrt2.o -L/usr/lib/gcc/darwin/3.3 -L/usr/lib/gcc/darwin -L/usr/libexec/gcc/darwin/ppc/3.3/../../.. /var/tmp//ccek5Tbt.o -lnsl -lsocket -lresolv -lstdc++ -lgcc -lSystem |
c++filt3
ld: can't locate file for: -lnsl


Can anyone tell me what I am doing wrong? Thanks for your help.

BG
 
The linker can't find the nsl, socket, and resolv libraries. Use the -L option and supply the path to the libraries.

Code:
-L/path/to/nsl/library
 
Back
Top