Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
[C++ Error] _algo.c(432): E2268 Call to undefined function 'rand'
|
This takes you to the following code in _algo.c:
// Return a random number in the range [0, __n). This function encapsulates |
IDE: C++ Builder 6.0
Compiler: Borland BCC32.EXE version 6.0.10.157
Project type: Console Application
The compiler cannot find the function rand (note that it does not complain that it cannot find std::rand). But it will only need rand when making use of the function above. For example, when you use std::random_shuffle.
#include <algorithm> |
It is not a good idea to modify standard header files. But the compiler cannot find rand, but it can find std::rand. So I add the namespace std to rand. And I have never had trouble with this.
// Return a random number in the range [0, __n). This function encapsulates |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.