Hey all,
I've searched on the internet, a found about 4 sites/forums where people had the same problem, except none of the solutions that were listed worked for me. I really don't know what's wrong, so either my compiler is acting up or I'm missing something so obvious that I don't even realize it. Here's the code:
Code://ClassMath.h #ifndef CLASS_MATH_H #define CLASS_MATH_H #include <cmath> #include <cstdlib> #include "ClassRange.h" using namespace std; class ClMath { public: static long double dPI; //Rounds value up or down static long int round(long double dNum); //Returns random value in range static long int randNum(ClRange<long int> rnRange); static int colorRegulator(int x, int r); }; #endifAnd the error is C:\...\ClassMath.cpp|35|error: no `int ClMath::colorRegulator(int, int)' member function declared in class `ClMath'.Code://ClassMath.cpp #include "ClassMath.h" using namespace std; long double ClMath::dPI = 4 * atan(1); long int ClMath::randNum(ClRange<long int> rnRange) { if((rnRange.getUpper() > RAND_MAX) && ((rnRange.getUpper() - rnRange.getLower()) > RAND_MAX)) { long int RandNum = rand(); long int nNumRands = static_cast<long int>((rnRange.getUpper() - rnRange.getLower()) / RAND_MAX); RandNum += (rand() % nNumRands ) * RAND_MAX; if ((rnRange.getUpper() - rnRange.getLower()) != RAND_MAX * nNumRands) RandNum += rand() % ((rnRange.getUpper() - rnRange.getLower()) - (RAND_MAX * nNumRands) + 1); return RandNum + rnRange.getLower(); } else return rand() % (rnRange.getUpper() - rnRange.getLower() + 1 ) + rnRange.getLower(); } long int ClMath::round(long double dNum) { if (static_cast<long int>(ceil(dNum + 0.5)) > static_cast<long int>(ceil(dNum))) return static_cast<int>(ceil(dNum)); else return static_cast<int>(floor(dNum)); } int ClMath::colorRegulator(int x, int r) { return static_cast<int>((pow(pow(255.0, x) * x / r, 1/x))); }
I'm using CodeBlocks with MinGW, and I've never had any problems before, so I hope this isn't the first.
Cheers,
Gabe



LinkBack URL
About LinkBacks




). I was uploading the files as you requested, and by chance noticed there was a ClassMath.h.gch file in the folder. So I went and removed that, and bingo, the program works. So, thank you for your help AND for your request I guess