How do I use the generator in the file? I keep randomc.h as a header file in the Visual c++ project. My project has several header files and several .cpp files, many of which require to use the random no. generator. I have copied all the files in the zip folder into the folder for my project files.
Do I write this in each file that uses the generator?
#ifndef MULTIFILE_PROJECT // If compiled as a single file then include these cpp files, // If compiled as a project then compile and link in these cpp files. // Include code for the chosen random number generator: #include "mersenne.cpp" // define system specific user interface: #include "userintf.cpp" #endif #include <time.h> // define time() #include "randomc.h"
The compling is ok. But I get a lot of linking errors, e.g.,
GABaseSolver.obj : error LNK2005: "private: void __thiscall CRandomMersenne::Init0(int)" (?Init0@CRandomMersenne@@AAEXH@Z) already defined in GA1DArraySolution.obj