[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    undeclared random() in builder/autorouter.cpp
From:       Achim Bohnet <ach () mpe ! mpg ! de>
Date:       2000-06-15 21:35:22
[Download RAW message or body]

FWIW: On Debian Linux Potato I get undeclared int random(void)
in autorouter.cpp:

g++ -DHAVE_CONFIG_H -I. -I../../../../kdemultimedia/arts/builder -I../.. \
-I/usr/local/opt/kde2/cvs-kde/include -I/usr/local/opt/kde2/cvs-qt/include   \
-I/usr/local/opt/kde2/cvs-kde/include/arts    -g -ansi -D_XOPEN_SOURCE -D_BSD_SOURCE \
-fno-exceptions -fno-rtti -fno-check-new -Wall -pedantic -W -Wpointer-arith \
-Wmissing-prototypes -Wwrite-strings -Wno-long-long -fno-builtin  -c \
                ../../../../kdemultimedia/arts/builder/autorouter.cpp
../../../../kdemultimedia/arts/builder/autorouter.cpp: In method \
                `AutoRouter::AutoRouter(int, int)':
../../../../kdemultimedia/arts/builder/autorouter.cpp:90: `random' undeclared (first \
use this function)

Option -ansi triggers the complain.  I fixed it by adding -D_SVID_SOURCE
because in stdlib.h random is wrapped between:

...
#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
...
/* These are the functions that actually do things.  The `random', `srandom',
   `initstate' and `setstate' functions are those from BSD Unices.
   The `rand' and `srand' functions are required by the ANSI standard.
   We provide both interfaces to the same random number generator.  */
/* Return a random long integer between 0 and RAND_MAX inclusive.  */
extern int32_t random __P ((void));
 
/* Seed the random number generator with the given number.  */
extern void srandom __P ((unsigned int __seed));                                      \
                
...

and defining _XOPEN_SOURCE_EXTENDED (listed in features.h) did not work.

Maybe configure support is needed to get the random right declaration :)

Achim


-- 
    To me vi is Zen.  To use vi is to practice zen. Every command is
    a koan. Profound to the user, unintelligible to the uninitiated.
    You discover truth everytime you use it.
					-- reddy@lion.austin.ibm.com

_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic