Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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

![]() |
![]() |
![]() |

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