| | |
Compile time errors in C++ while generating random numbers
![]() |
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
•
•
Join Date: Feb 2008
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
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
•
•
•
•
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
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
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
![]() |
Similar Threads
Other Threads in the C++ Forum
- Previous Thread: FindFirstFile()
- Next Thread: if statement involving array of a class (C2451)
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code codesamplerunwhilecommands coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error faq file forms fstream function functions game givemetehcodez graph guess gui hash homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker listing loop looping loops map math matrix memory multiple news node output pointer port problem proficiency program programming project python random read recursion reference rpg string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






