Naive question about using the C++ library

The code that I have includes "Random.h"
but the library I have has "random" but
not Random.h.  

What are my options?

Actually, there are a whole
series of header files that the code asks
for but which are not in the library that I have
access to, including:

#include <cstring>
#include <Random.h>
#include <Uniform.h>
#include <MLCG.h>
#include <Poisson.h>
#include <NegExp.h>
#include <DiscUnif.h>
#include <ctime>

I inherited a c++ code and I would like to
turn it into a portable (or even semi-portable) c++ code.

More specifically, it was written under
"gcc version 2.8.1" and I would like to
make it work with at least one other compiler.
The compiler that I have access to is
DEC/Compaq's cxx for the Alpha processor.

The code doesn't do anything particularly fancy.
It uses random numbers, but the random numbers
don't have to be very random.  It does file I/O
but nothing fancy there either.

I look forward to your answer.

Ken
klopterAsked:
Who is Participating?
 
nietodConnect With a Mentor Commented:
random.h is not a standard C++ header file and random() is not a standard C++ function.  So use fo these prevents portability.  

To stay portable, you can use the rand() function in the <stdlib.h> file.
0
 
nietodCommented:
Its hard to say what to do about those other files, they are less likely to have cooresponding standard counterparts.  For <cstring> you cna probalby use the STL string class defined in <string>, but it is likely that you will have to make some changes in the code (mostly in syntax, not in design) to accomodate the change.  The other will be myuch harder, it might help if we know what you were using from them.
0
 
KangaRooCommented:
You could try to compile them on the new target?
0
 
klopterAuthor Commented:
That gives me enough to start with.

When I figure out what the code is
using the other header files for
I'll post another question or two.

Thanks,
  Ken
P.S.  I figured that Scott Meyer's
book would be known here, though I
didn't know that he has been deified.
The two C++ books I own are Meyer's
and Stroustrup's.  I enjoy reading
Scott's but I haven't been able to
get myself to plow through much of
Bjarne's.
0
 
nietodCommented:
Meyer has two books, "Effective C++" and "More Effective C++"  (The "more" is not a second edition, it is a seperate book) and I strongly recommend you get both.  I probably consult them close to once a week myself.
0
All Courses

From novice to tech pro — start learning today.