这是我工作的游戏引擎的代码的一部分。当我编译/调试代码时,它停止编译器错误:“Camera.cpp(70):error C2059:syntax error:'=='”and line 70 is the语法错误“==”
if (near == far)
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;
}
}
}
我有使用==操作符以同样的方式等功能,但他们没有得到一个错误。谢谢,如果您有任何建议...
“远”是一个保留字吗? – asawyer 2012-08-09 20:28:39
@asawyer:不,你正在考虑'for' :) – 2012-08-09 20:29:37
@PeterAlexander不,我在想远点。 – asawyer 2012-08-09 20:30:14