These are the errors I get using Visual Studio
1>------ Build started: Project: DEMO2, Configuration: Debug Win32 ------
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>main.obj : error LNK2005: "public: __thiscall aRandomNumberGenerator::aRandomNumberGenerator(voi d)" (??0aRandomNumberGenerator@@QAE@XZ) already defined in rng.obj
1>main.obj : error LNK2005: "public: void __thiscall aRandomNumberGenerator::setSeed(unsigned long)" (?setSeed@aRandomNumberGenerator@@QAEXK@Z) already defined in rng.obj
1>main.obj : error LNK2005: "public: double __thiscall aRandomNumberGenerator::generate(void)" (?generate@aRandomNumberGenerator@@QAENXZ) already defined in rng.obj
1>C:\Users\Neesha\Documents\Visual Studio 2008\Projects\DEMO2\Debug\DEMO2.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Build log was saved at "file://c:\Users\Neesha\Documents\Visual Studio 2008\Projects\DEMO2\Debug\BuildLog.htm"
1>DEMO2 - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I fixed the errors and my program works now :)
THANKS FOR ALL THE HELP!!!!!
The code might seem to be working now but be aware that there are a couple of things your teacher might frown upon in the code that Skreaminskull gave you:
Originally Posted by girly_engineer
First of all, don't ever include a .cpp file, it's wrong, we only include .h or .hpp files, never .cpp!
Second of all, the code never calls the setseed() function, so the number will not be random at all.
Third of all, your setseed() function doesn't utilize the unsigned int parameter that you gave it, it just uses some magic number which is not only a poor way of coding, it also looks unfinished, as if you wrote the code to test the functionality and then never finished it?