I wrote this section of code here today and everything went bad and i dont have a flipin clue why! More than likely i am simply missing a very minuet error probably from staring at the same lines of code for the past 7 hours.
these are the error messages i get ONLY in the section that i just wrote:
in_camera.cpp(453) : error C2143: syntax error : missing ';' before ')'
in_camera.cpp(454) : error C2143: syntax error : missing ';' before '{'
in_camera.cpp(454) : error C2059: syntax error : '='
in_camera.cpp(454) : error C2143: syntax error : missing ')' before ';'
in_camera.cpp(454) : error C2143: syntax error : missing ';' before ')'
in_camera.cpp(454) : error C2059: syntax error : ')'
in_camera.cpp(455) : error C2143: syntax error : missing ';' before '{'
in_camera.cpp(455) : error C2059: syntax error : '='
in_camera.cpp(455) : error C2143: syntax error : missing ';' before ')'
in_camera.cpp(457) : error C2181: illegal else without matching if
in_camera.cpp(457) : error C2059: syntax error : '='
except that there are like 80 more.
And here is the code i wrote.
//=====================================================================================================================
// Pirpose: Aim command, move cam over char's R shoulder
//========================================================
if( input->KeyState(&cam_aim) )
{ if( IsAim != true )
{ float AIMDP = cam_idealdist.GetFloat();
float AIMYP = cam_idealyaw.GetFloat();
float AIMPP = cam_idealpitch.GetFloat();
}
IsAim = true;
float CURD = cam_idealdist.GetFloat();
float CURY = cam_idealyaw.GetFloat();
float CURP = cam_idealpitch.GetFloat();
if( CURD != AIM_DIST )
{ if( (CURD - AIM_DIST) < 1.0 )
{ CURD -= (CURD - AIM_DIST);
}
else if( (CURD - AIM_DIST) < 9.0 )
{ CURD -= 0.5;
}
else if( (CURD - AIM_DIST) < 20.0 )
{ CURD -= 0.8;
}
else
{ CURD -= 1.0;
}
}
if( CURY != AIM_YAW )
{ if( (CURY > AIM_YAW )
{ if( (CURY - AIM_YAW) < 1.0)
{ CURY -= (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) < 10.0)
{ CURY -= 0.7;
}
else
{ CURY -= 1.0;
}
}
if( CURY < AIM_YAW )
{ if( (CURY - AIM_YAW) > -1.0)
{ URY += (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) > -10.0)
{ CURY += 0.7;
}
else
{ CURY += 1.0;
}
}
}
if( CURP != AIM_PITCH )
{ if( (CURP - AIM_PITCH) < 1.0 )
{ CURP -= (CURP - AIM_PITCH);
}
else if( (CURP - AIM_PITCH) < 10.0)
{ CURP -= 0.7;
}
else
{ CURP -= 1.0;
}
}
}
else
{ IsAim = false;
cam_idealdist.SetValue(AIMDP);
cam_idealyaw.SetValue(AIMYP);
cam_idealpitch.SetValue(AIMPP);
}
//================================================================================================================
Please, some one take a look and point out whats is wrong! I cant figure it out and would really appreciate if some one would help me out.
Thank

Repedative Syntax error : missing '=' and ')' and ';'
Tian
netguruf
I'm an old guy so I tend to compile from the command-line most of the time - and I still feel that this is a skill that is useful - especially for learning how the compiler works. In this case I would use
cl /P <other-options> myfile.cpp
This will cause the compiler to generate myfile.i
From the IDE I would go to Project -> Properties -> C/C++ -> Preprocessor
and then change "Generate Preprocessed File" to one of the "Yes" options.
Pradeep K R
MB98
look carefully at the line in the middle of these:
if( CURY != AIM_YAW )
{ if( (CURY > AIM_YAW )
{ if( (CURY - AIM_YAW) < 1.0)
there's a ( that shouldn't be there ;)
Next time to make things a bit easier, you should indicate which line/lines are the ones that have the error ;)
bmw19314
float aimDistAdj( float curd )
{
if(CURD != AIM_DIST )
// ....
In line 3, is CURD supposed to be the curd from the function arguments(line1 Because if that's the case then you have to write it the same way you have in the arguments. In C/C++ variables/constants/etc.. are case sensitive.
Cameron Black
sounds great, although one problem. Where do i put in those switches Bear with me, im a self taught programmer.
AnhTinLove
wvbotha
I totally understand and agree Jonathan. Although im from a bit younger generation, i know the importance of knowing how and why a program or operating systems does what it does behind the scnenes. if i had known about the compiler command line i would have been using that already, my problem is that i have only just recently made the jump from C++ to Visual C++. so im still getting used to VC++ .NET '03.
Thanks for the help, i really appreciate it!
Nathan
SPDOTNET
laforced
Unfortunatly i already caught that error and it still wasnt it. ive now rewritten the whole section into three seperate function and still the exact same thing.
This is what it looks like now and the errors start with " missing '=' " at the very first if statement.
===========================================================================
float aimDistAdj( float curd )
{
if(CURD != AIM_DIST )
{ if( (CURD - AIM_DIST) < 1.0 )
{ CURD -= (CURD - AIM_DIST);
}
else if( (CURD - AIM_DIST) < 9.0 )
{ CURD -= 0.5;
}
else if( (CURD - AIM_DIST) < 20.0 )
{ CURD -= 0.8;
}
else
{ CURD -= 1.0;
}
}
return curd;
}
float aimYawAdj( float cury )
{
if( CURY != AIM_YAW )
{ if( CURY > AIM_YAW)
{ if( (CURY - AIM_YAW) < 1.0 )
{ CURY -= (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) < 10.0)
{ CURY -= 0.7;
}
else
{ CURY -= 1.0;
}
}
if( CURY < AIM_YAW )
{ if( (CURY - AIM_YAW) < -1.0)
{ CURY += (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) < -10.0)
{ CURY += 0.7;
}
else
{ CURY += 1.0;
}
}
}
return cury;
}
float aimPitchAdj( float curp )
{
if( CURP != AIM_PITCH )
{ if( (CURP - AIM_PITCH) < 1.0 )
{ CURP -= (CURP - AIM_PITCH);
}
else if( (CURP - AIM_PITCH) < 10.0)
{ CURP -= 0.7;
}
else
{ CURP -= 1.0;
}
}
return curp;
}
==========================================================================
This is driving me batty!
woodland30033
If you post the code you're using maybe I (or someone else) will be able to help.
Butterfly Boy
Well, this code is OK (compiles successfully).
float AIM_DIST = 0.0f;
float AIM_YAW = 0.0f;
float AIM_PITCH = 0.0f;
float aimDistAdj( float curd )
{
if(curd != AIM_DIST )
{ if( (curd - AIM_DIST) < 1.0 )
{ curd -= (curd - AIM_DIST);
}
else if( (curd - AIM_DIST) < 9.0 )
{ curd -= 0.5;
}
else if( (curd - AIM_DIST) < 20.0 )
{ curd -= 0.8;
}
else
{ curd -= 1.0;
}
}
return curd;
}
float aimYawAdj( float CURY )
{
if( CURY != AIM_YAW )
{ if( CURY > AIM_YAW)
{ if( (CURY - AIM_YAW) < 1.0 )
{ CURY -= (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) < 10.0)
{ CURY -= 0.7;
}
else
{ CURY -= 1.0;
}
}
if( CURY < AIM_YAW )
{ if( (CURY - AIM_YAW) < -1.0)
{ CURY += (CURY - AIM_YAW);
}
else if( (CURY - AIM_YAW) < -10.0)
{ CURY += 0.7;
}
else
{ CURY += 1.0;
}
}
}
return CURY;
}
float aimPitchAdj( float CURP )
{
if( CURP != AIM_PITCH )
{ if( (CURP - AIM_PITCH) < 1.0 )
{ CURP -= (CURP - AIM_PITCH);
}
else if( (CURP - AIM_PITCH) < 10.0)
{ CURP -= 0.7;
}
else
{ CURP -= 1.0;
}
}
return CURP;
}
Do you get any error for it
jbaynham