I have borland C++ compiler on my system.while generating random numbers in C++,though i have incuded #include<cstdlib> and #include<iostream> i get these errors
1.cannot open include file cstdlib
2.call to undefined function rand
please help me with a solution

Recommended Answers

All 4 Replies

I checked my old Borland C++ compiler, you may have to add the .h to your includes!

#include<iostream.h>
#include<cstdlib.h>

Can you please post your code here? That second part looks like you've not defined a function or something. Perhaps you've misnamed a function that you created, or you're #including a wrong library or something. Either way, post your code, and we'll be able to help you troubleshoot it.

I have borland C++ compiler on my system.while generating random numbers in C++,though i have incuded #include<cstdlib> and #include<iostream> i get these errors
1.cannot open include file cstdlib
2.call to undefined function rand
please help me with a solution

as for the second error its because your calling rand() which is in the file math.h try including that the compile again

I checked my old Borland C++ compiler, you may have to add the .h to your includes!

#include<iostream.h>
#include<cstdlib.h>

as for the second error its because your calling rand() which is in the file math.h try including that the compile again

Ahhh, all these clueless people.

Obviously iostream worked. But cstdlib didn't. Change it to stdlib.h instead. We won't even mention math.h

You might consider upgrading to at least Borland 5.5

Or one of these that have an IDE:
Code::Blocks
MSVC++ Express
Open Watcom C++/Fortran
Bloodshed DevC

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.