this is part of my code to my game engine that I am working on. When I build/debug the code, it stops with a compiler error: “Camera.cpp(70): error C2059: syntax error : ‘==’ ” and line 70 is the
if ( near == far ) line. It also happens on line 75:
(if near == NULL || far == NULL)
bool Camera::SetClippingPlanes( float near, float far )
{
if (near == far) //Line 70(First Error)
{
MessageBox(NULL, L"ERROR: The far and near clipping planes cannot be equal!", L"Error", MB_OK | MB_ICONERROR);
return false;
}
else
{
if (near == NULL || far == NULL) //Line 75(Second Error)
{
MessageBox(NULL, L"ERROR: Near and/or Far clipping planes are null!", L"Error", MB_OK | MB_ICONERROR);
return false;
}
else
{
nearPane = near;
farPane = far;
return true;
}
}
}
I have other functions which use the == operator in the same way, but they do not receive an error. Thanks if you have any suggestions…
Many years ago (in a galaxy far, far away)
nearandfarwere keywords. It looks like your compiler still thinks they are – it’s probably trying to be helpful.You either need to pick different names, or figure out how to turn off this particular backward-compatible ‘feature’.