1,000,000 undeclared identifiers!

Posted By: Impaler

1,000,000 undeclared identifiers! - 02/13/08 11:12

I have noticed some posts where undeclared identifiers and syntax errors
occur in lite-c even though the syntax is sound according to the manual.
I have just started migrating to lite-c, and almost every single thing I type in gives me the 'undeclared identifier' error upon compilation. I would like to know which of the following lines of code would be responsible for this, and maybe some forewarning about other code differences.(This is the only code in my .c file.)

Code:

action player_soldier()
{
var vel[3] = (0, 0, 0);//velocity in x, y, z
var accel[3] = (0, 0, 0);//velocity in x, y, z
var timer = 0;//general timer
my.skill9 = 100;
while(1)
{
accel[0] = key_w;//control acceleration by keyboard
accel[1] = key_d;
accel[0] -= key_s;
accel[1] -= key_a;
vel[0] += accel[0];
vel[1] += accel[0];
vel[0] = max(vel[0], -20);
vel[0] = min(vel[0], 20);
vel[1] = max(vel[1], -20);
vel[1] = min(vel[1], 20);
my.x += vel[0] * cos(my.pan)* time;
my.y += vel[1] * sin(my.pan) * time;
camera.z = my.z + 100;
camera.x = my.x;
camera.y = my.y;
wait(1);}
}


Posted By: Excessus

Re: 1,000,000 undeclared identifiers! - 02/13/08 11:34

I'm not sure, but I think you have to include <acknex.h> and <afuncs.h>, or some engine functions will be undeclared.
Posted By: Impaler

Re: 1,000,000 undeclared identifiers! - 02/13/08 11:41

sorry, I forgot to mention that I also had a starter script in which those files were included. It looked like this:

Code:
 

#include <acknex.h>;
#include <default.c>;
#include "WWII_fps.c";
var video_mode = 6;
var video_depth = 16;
STRING level_str = "Caen.wmb";
function main()
{
tex_share = 1;
level_load(level_str);

}



Posted By: Lukas

Re: 1,000,000 undeclared identifiers! - 02/13/08 14:37

max(...) -> maxv(...)
min(...) -> minv(...)


time -> time_step


STRING -> STRING*


var video_mode = 6;
var video_depth = 16;
->
function main ()
{
video_mode = 6;
video_depth = 16;
...
}



Posted By: oldschoolj

Re: 1,000,000 undeclared identifiers! - 02/13/08 14:39

I'm pretty sure that a "*" is required behind that STRING declaration. So it woud be STRING*
Posted By: PrenceOfDarkness

Re: 1,000,000 undeclared identifiers! - 02/13/08 20:10

var vel[3] = (0, 0, 0);//velocity in x, y, z

I think should be

var vel[3] = {0,0,0};
or if just enter 1 0 they are all set to zero (i do this and it works)

var vel[3] = {0};
Posted By: Impaler

Re: 1,000,000 undeclared identifiers! - 02/14/08 11:53

Thanks, guys, those are very helpful! It's nice to know about the differences in syntax like that.
© 2024 lite-C Forums