Dave Burns
2006-07-12 15:24:46 UTC
Hi, I want to use the rand_s function in my application.
I have included the following at the top of my module that uses the
function:
#define _CRT_RAND_S
#include <cstdlib>
I invoke the function as follows:
unsigned number;
errno_t err = rand_s(&number);
The compiler generates the error "C3861: 'rand_s': identifier not found". I
am using VS-2005.
I looked in cstdlib and stdlib.h. I can see the declaration in stdlib.h as
follows:
#if defined(_CRT_RAND_S)
_CRTIMP errno_t __cdecl rand_s ( __out unsigned int *_RandomValue);
#endif
There are a lot of "#if" statements in this header and I'm wondering if one
of them is negating the declaration.
Thanks for any advice, Dave
I have included the following at the top of my module that uses the
function:
#define _CRT_RAND_S
#include <cstdlib>
I invoke the function as follows:
unsigned number;
errno_t err = rand_s(&number);
The compiler generates the error "C3861: 'rand_s': identifier not found". I
am using VS-2005.
I looked in cstdlib and stdlib.h. I can see the declaration in stdlib.h as
follows:
#if defined(_CRT_RAND_S)
_CRTIMP errno_t __cdecl rand_s ( __out unsigned int *_RandomValue);
#endif
There are a lot of "#if" statements in this header and I'm wondering if one
of them is negating the declaration.
Thanks for any advice, Dave