Help needed for compiling ns-2
Mon, 8 Sep 1997 18:20:27 -0400
> I post this problem before and still can not solve the problem.
> The following is the error message when I compile ns-2.0b17
> c++ -o net-ip.o -c -I/homes/chensg/ns-2.0b17/../Tcl
-I/homes/chensg/ns-2.0b17/../tcl7.6/generic -I. -DNEED_SUNOS_PROTOS
-DUSE_SHM -DHAVE_LIBOTCL0_96 -DHAVE_OTCL_H -DHAVE_LIBTK4_2 -DHAVE_TK_H
-DHAVE_LIBTCL7_6 -DHAVE_TCL_H -DNO_TK -Dabort=_ABORT -O2 net-ip.cc
> net-ip.cc: In method `int IPNetwork::command(int, const char *const *)':
> net-ip.cc:134: `IP_MULTICAST_LOOP' undeclared (first use this function)
> net-ip.cc:134: (Each undeclared identifier is reported only once
> net-ip.cc:134: for each function it appears in.)
> net-ip.cc: In method `int IPNetwork::open(int)':
> net-ip.cc:195: warning: implicit declaration of function `int bzero(...)'
> net-ip.cc: In method `void IPNetwork::localname(struct sockaddr_in *)':
> net-ip.cc:284: warning: implicit declaration of function `int
> *** Error code 1
> make: Fatal error: Command failed for target `net-ip.o'
> Obviously, compiler can not find IP_MULTICAST_LOOP. I fetch the tar file
> again, still get the same result. IP_MULTICAST_LOOP is not defined
> in the ns-2 source tree. So it must be defined in some include file
> in the unix system. I am not familiar with the multicasting in IP.
> Could someone tell where IP_MULTICAST_LOOP should be?
> Web: http://yake.ecn.purdue.edu/~shaogang Purdue University
> Office: MSEE 292 Phone: (765) 494-0434 W. Lafayette, IN 47907
I have seen somebody reporting the same problem some weeks ago. I made
him/her(?) the following suggestions, although it seemed not to help much.
First thing: Forget about the 2 warnings (or see 2nd and 3rd if you want to
get rid of them). You need only the 1st issue (I had the same error messy
and it worked for me...)
Look in which include-file "IP_MULTICAST_LOOP" is defined by doing a
"cd /usr/include" and then a
find . -name "*.h" -print | xargs grep IP_MULTICAST_LOOP
Make sure to include that file into net-ip.cc
bzero is usually defined in <strings.h>, but sometimes it's not. Just type
a "man memset" to see which header-file to include. If nothing else helps,
you can always
replace the bzero(addr, len)-command with memset(addr, 0, len), which
should be in <string.h>.
Type a "man getsockname" to see where it is defined.