Evil Error

Started by
5 comments, last by Drakon 22 years ago
I have these two errors: --------------------Configuration: 3dMaze5 - Win32 Debug-------------------- Compiling... Main.cpp C:\3dMaze5\Main.cpp(95) : warning C4018: ''<'' : signed/unsigned mismatch C:\3dMaze5\Main.cpp(211) : error C2446: ''<'' : no conversion from ''double *'' to ''double'' There is no context in which this conversion is possible C:\3dMaze5\Main.cpp(211) : error C2115: ''<'' : incompatible types Error executing cl.exe. 3dMaze5.exe - 2 error(s), 1 warning(s) ---------------------------------------------------------------- These are my declarations: double MaxX; double MaxY; double MinX; double MinY; double MaxX2[1]; double MaxY2[1]; double MinX2[1]; double MinY2[1]; These are how they are used: MaxY = posx + 1; MinX = posx - 1; MaxY = posz + 1; MinY = posz - 1; MaxX2[0] = 22.5;MaxY2[0] = 16;MaxX2[0] = 22.5;MinY2[0] = 16.5; MaxX2[1] = 22.5;MaxY2[1] = 16;MaxX2[1] = 22.5;MinY2[1] = 16.5; for(Num = 0;Num == 1; Num = Num + 1){ if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2){ Collision = true; } }
"Go for the eyes, Boo, go for the eyes!"
Advertisement
At the end of the condition you''ve forgotten to bracket the array: MinX < MaxX2 - looks like it should be MinX < MaxX2[num]



"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Your IF statment is not orginized....


    if (( [condition1] ) && ( [condition2] ))    


EDIT: Your compiler does not know which statment to test, use '(' and ')' to seperate conditions.
_____________________________________________________

ICQ #: 149510932
Google - OpenGL - DirectX - Windows Guide Network - MSDN - Symantec Virus Info
"Imagination is more important than knowledge." - Albert Einstein



[edited by - Programmer One on March 19, 2002 8:56:14 PM]
Check out this line:

if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2){

MaxX2 should be MaxX2[num]

Pointers are unsigned while doubles are signed, hence the error.
As soon as you said MaxX2[1] = 22.5; there is a problem. You only have 1 element in all of your arrays, which is at index 0. So this MaxX2[1] (and the others) is out of bounds.
quote:Original post by Drakon
for(Num = 0;Num == 1; Num = Num + 1){
// whatever was here...
}


Don't forget the errors it doesn't tell you about... The body of the for loop will never be executed. Try Num <= 1 instead of Num == 1.

[edit 1]:
// Here is how it _should_ be... (assuming your logic is correct)double MaxX2[2]; // note it isn't [1] anymoredouble MaxY2[2];double MinX2[2];double MinY2[2];These are how they are used:for(Num = 0;Num <= 1; Num = Num + 1) // Num <= 1 not Num == 1{  if(MaxY > MinY2[Num] && MinY < MaxY2[Num] && MaxX > MinX2[Num] && MinX < MaxX2[Num]) // note MaxX2 now is MaxX2[Num]  {     Collision = true;  }}  


- mongrelprogrammer

[edited by - mongrelprogrammer on March 19, 2002 9:31:27 PM]

[edited by - mongrelprogrammer on March 19, 2002 9:32:37 PM]
- I hate these user ratings. Please rate me down. (Seriously) -
quote:Original post by Programmer One
Your IF statment is not orginized....
if (( [condition1] ) && ( [condition2] ))
EDIT: Your compiler does not know which statment to test, use '(' and ')' to seperate conditions.


That's not true, order of operations denotes the && operator to be applied lastly. Parenthesis are not necessary.

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."

[edited by - Matt Calabrese on March 19, 2002 9:22:36 PM]

This topic is closed to new replies.

Advertisement