Compile time errors in C++ while generating random numbers

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 1
Reputation: charles_wt is an unknown quantity at this point 
Solved Threads: 0
charles_wt charles_wt is offline Offline
Newbie Poster

Compile time errors in C++ while generating random numbers

 
0
  #1
Nov 2nd, 2004
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3,941
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 911
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Compile time errors in C++ while generating random numbers

 
0
  #2
Nov 2nd, 2004
I checked my old Borland C++ compiler, you may have to add the .h to your includes!

#include<iostream.h>
#include<cstdlib.h>
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Compile time errors in C++ while generating random numbers

 
0
  #3
Nov 2nd, 2004
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.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1
Reputation: romerboy55 is an unknown quantity at this point 
Solved Threads: 0
romerboy55 romerboy55 is offline Offline
Newbie Poster

Re: Compile time errors in C++ while generating random numbers

 
0
  #4
Feb 9th, 2008
Originally Posted by charles_wt View Post
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
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Compile time errors in C++ while generating random numbers

 
0
  #5
Feb 9th, 2008
Originally Posted by vegaseat View Post
I checked my old Borland C++ compiler, you may have to add the .h to your includes!

#include<iostream.h>
#include<cstdlib.h>
Originally Posted by romerboy55 View Post
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
Last edited by WaltP; Feb 9th, 2008 at 10:06 pm.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC