[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ns-2.1b3 daily snapshot won't compile



On Fri, 17 Apr 1998 14:02:13 MDT, Jeffrey Austen wrote: 
>I fetched the daily snapshot of ns-2.1b3 today (April 17) and it will not
>compile. The system is Linux, Debian distribution, and the compiler is gcc
>version 2.7.2.1. Here is the error message:
>
>shannon$ make
>c++ -c -g -DNO_TK  -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL1_0B5 -DHAVE_TCLCL_H
>-DHAVE_LIBOTCL1_0A2 -DHAVE_OTCL_H -DHAVE_LIBTK4_2 -DHAVE_T
>K_H -DHAVE_LIBTCL7_6 -DHAVE_TCL_H  -I. -I../tclcl-1.0b5
>-I/usr/local/include -I/usr/include/tcl -I/usr/include/tcl  -o random.o rand
>om.cc
>random.cc: In function `int random()':
>random.cc:50: new declaration `int random()'
>/usr/include/stdlib.h:198: ambiguates old declaration `long int random()'
>make: *** [random.o] Error 1
>shannon$

There seems to be differences in Linux definitions of random.
The Right Thing is to have autoconf detect the type of random,
but (since I've not done that before) that's low on the priority list
right now  (code contributions are welcome, of course---it should be
easy to do this in autoconf).

Another approach would be to use an #define which differs between
Debian and RedHat.  I don't know of such a #define.

Until it's fixed the Right Way, this patch should work around the problem:


--- random.cc~	Tue Apr 14 14:07:04 1998
+++ random.cc	Tue Apr 21 10:50:07 1998
@@ -41,11 +41,7 @@
 #include <sys/time.h>
 #include "random.h"
 
-#ifdef linux
-int
-#else
 long
-#endif
 random()
 {
 	printf("random() called in ns.\nRandom is not portable, please use Random::uniform() instead.\n");


   -John Heidemann