Error
-
- Posts: 368
- Joined: Thu Jun 25, 2009 4:45 am
- Location: Michigan
well... it says min isn't declared. so I'm going to say its because you didn't declare min. At least not anywhere that the compiler is meant to be looking.
Remember that it needs to be seen before, not after. And within that C file, not some other C file. And if its within some other function then that doesn't count either, etc.
Remember that it needs to be seen before, not after. And within that C file, not some other C file. And if its within some other function then that doesn't count either, etc.
-
- Posts: 368
- Joined: Thu Jun 25, 2009 4:45 am
- Location: Michigan
Spike wrote:well... it says min isn't declared. so I'm going to say its because you didn't declare min. At least not anywhere that the compiler is meant to be looking.
Remember that it needs to be seen before, not after. And within that C file, not some other C file. And if its within some other function then that doesn't count either, etc.
Wow, I am so confused.
I can't believe I made that mistake.
Anyways, I already tried to declare min before, it turns out I had put it in the wrong spot.
I was just being lazy and threw it at the very top and what do you know, it worked.
Wow, from now on, wait an hour to do Quake Engine Programming after you have gotten completely smashed.
min is an intrinsic function to C I believe, so that might be your problem. If it's a var, change the name to something else and see if it works.
http://red.planetarena.org - Alien Arena and the CRX engine
-
- Posts: 368
- Joined: Thu Jun 25, 2009 4:45 am
- Location: Michigan
Irritant wrote:min is an intrinsic function to C I believe, so that might be your problem. If it's a var, change the name to something else and see if it works.
Well, it is from the Half-Life BSP tutorial.
Code: Select all
byte vid_gamma_table[256];
void Build_Gamma_Table (void) {
int i;
float inf;
float in_gamma;
if ((i = COM_CheckParm("-gamma")) != 0 && i+1 < com_argc) {
in_gamma = Q_atof(com_argv[i+1]);
if (in_gamma < 0.3) in_gamma = 0.3;
if (in_gamma > 1) in_gamma = 1.0;
} else {
in_gamma = 1;
}
if (in_gamma != 1) {
for (i=0 ; i<256 ; i++) {
inf = min(255 * pow((i + 0.5) / 255.5, in_gamma) + 0.5, 255);
vid_gamma_table[i] = inf;
}
} else {
for (i=0 ; i<256 ; i++)
vid_gamma_table[i] = i;
}
}
You're probably missing a header file that includes the definition for min. Might need #include math.h, I think it is in that one.
http://red.planetarena.org - Alien Arena and the CRX engine