Computing.Net > Forums > Programming > Problem with newran in C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Problem with newran in C++

Reply to Message Icon

Name: cjewell
Date: February 28, 2004 at 19:18:09 Pacific
OS: Fedora 1
CPU/Ram: P4/256MB
Comment:

Hi,

I have a programming problem - surprise surprise! I am currently writing a program to stochastically model the occurance of antibiotic resistance in Campylobacter and have written a class the basically runs the model, returning a pointer to an array where all the output is stored. I am using the "newran" random number class library which contains a convenient set of classes that I need.

What I originally intended was to have a header file for my model class, stochastic.h, to go with the body, stochastic.cpp. Obviously the class declaration needed to go in the header file. The class declaration contains a declaration of the random-number generator object that I need for the model. In order to declare this (as a "Uniform" object in the newran class libary) I had to include the "newran.h" header in stochastic.h. This, however, led to problems in compiling one of the header files needed in newran.h. If I include newran.h in the body file stochastic.cpp everything is fine - apart from the fact that I have to dispense with stochastic.h and declare the class in the body file.

I'm fairly new to C++ and still finding my way - does anyone have any advice they could give me? Is this likely to be a bug in the newran class library?

Thanks,

Chris Jewell



Sponsored Link
Ads by Google

Response Number 1
Name: cjewell
Date: February 28, 2004 at 19:31:32 Pacific
Reply:

Actually, to add to the weirdo problem, I get the same compile error if I include the newran.h file before I've declared my stochastic model class. If I include it after I've defined my class, then all is fine - except I still can't declare the Uniform object in the class definition - kind of essential!

Chris


0

Response Number 2
Name: cjewell
Date: February 28, 2004 at 19:34:07 Pacific
Reply:

Scratch that folks! Just a problem with namespaces!

Well I said I was new to C++.....!

Chris


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Problem with newran in C++

Problem with strings in c++ www.computing.net/answers/programming/problem-with-strings-in-c/6204.html

Problem reading file in c++ www.computing.net/answers/programming/problem-reading-file-in-c/7826.html

Classes in C++ www.computing.net/answers/programming/classes-in-c/11619.html