Inside3D!
     

Error

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
Team Xlink



Joined: 25 Jun 2009
Posts: 320

PostPosted: Thu Aug 13, 2009 9:59 pm    Post subject: Error Reply with quote

Solved.
_________________
Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!


Last edited by Team Xlink on Tue Nov 17, 2009 2:21 am; edited 1 time in total
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Aug 14, 2009 12:43 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Team Xlink



Joined: 25 Jun 2009
Posts: 320

PostPosted: Fri Aug 14, 2009 1:44 am    Post subject: Reply with quote

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.
_________________
Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!
Back to top
View user's profile Send private message
Irritant



Joined: 19 May 2008
Posts: 115
Location: Maryland

PostPosted: Fri Aug 14, 2009 3:36 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Team Xlink



Joined: 25 Jun 2009
Posts: 320

PostPosted: Fri Aug 14, 2009 4:06 am    Post subject: Reply with quote

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:

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;
   }
}


I am working on our PC Engine.
_________________
Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!
Back to top
View user's profile Send private message
Irritant



Joined: 19 May 2008
Posts: 115
Location: Maryland

PostPosted: Sat Aug 15, 2009 4:46 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Sat Aug 15, 2009 6:30 am    Post subject: Reply with quote

yep math.h older msvc doesnt seem to have it defined tho.
in that case put these in quakedef.h somewhere at the top after the includes.

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group