random() and srandom() unresolved links
Hi all
I'm writing a software to be compiled and run on C++ BuilderX. I'm using the standard random generators functions random() and srandom() in my program.here is how I declare these using precompiler directives to support cross-platform behavior:
Code:
// "standard" random number generators
#ifdef USING_SGI // SGI versions
extern "C" long random(void);
extern "C" void srandom(unsigned);
#endif
#ifdef USING_SUNOS5 // SUNOS5 versions
extern "C" int random(void);
extern "C" int srandom(unsigned);
#endif
#ifdef USING_CBX
/*support for CBX platform*/
extern "C" int random(void);
extern "C" void srandom(unsigned);
#endif
when i build my program i got theses link errors :
Code:
Error: Unresolved external 'srandom(unsigned int)' referenced from C:\CPPBUILDERX\ANN_0.2\WINDOWS\DEBUG_BUILD\RAND.OBJ
Error: Unresolved external 'random()' referenced from C:\CPPBUILDERX\ANN_0.2\WINDOWS\DEBUG_BUILD\RAND.OBJ
ILINK32 exited with error code: 2
Build cancelled due to errors
I guess the problem is in the prototype declarations :
Code:
extern "C" int random(void);
extern "C" void srandom(unsigned);
I can't figure out what are the prototypes of random() and srandom() in windows Borland c++ Builder X
any Ideas ?
please help !
thanks