Undeclared function?

I'm getting an error saying 'not_equal_to undeclared. First use this function.'
but not_equal_to is not a variable its a function. and it is defined directly above it, outside any other function. Why am I getting this error? I'm trying to read the output of my not_equal_to function using this statement:

1
2
     	if ( not_equal_to(__a,i) == 0 )
      		continue;


and directly above this function i have it defined:

1
2
3
4
5
6
7
8
9
10
11
int not_equal_to(int _h, int value)
{
    int result;
    result=1;
    for (int u=0;u<_h;u++)
    {
    if (value=point[u])
    result=0;
    }
    return result;
}


This is really confusing me. What is going on?
Can you give us more of the code, doesn't seem to be any obvious errors in what you've posted.
the exact code fragment below.
i have no idea why it is giving me errors.
in line 18 it says not_equal_to is undeclared (first use this function)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
int not_equal_to(int _h, int value)
{
    int result;
    result=1;
    for (int u=0;u<_h;u++)
    {
    if (value=point[u])
    result=0;
    }
    return result;
}

int closest_point (int __a)
{
         int find_closest_to=__a;
     int closest=-1;
     for (int i=0;i<amm;i++){
     	if ( not_equal_to(__a,i) == 0 )
      		continue;
    	if (closest<0 || find_distance(closest,point[find_closest_to])>find_distance(i,point[find_closest_to]))
     		closest=i;
       }
       if (closest<0)
           {
       	   cout << "Error occured in locating points.";
           }
     return closest;
}
Last edited on
Line 7: Where is point declared?
and it should be ==, not =
Last edited on
that was only a fragment of the code, point was defined higher up.
but it still returned the error
but i fixed it by changing the name of the function to not_e_to.
is not_equal_to a pre-defined constant or something?
it could already be declared in a header you have imported.
thanks that worked, but now i have a bigger problem that can't be resolved without seeing the whole code and knowing what the purpose of the code is.
the whole thing is 158 lines so far, would i be able to post it all here or is that too much code for someone here to spend time looking at?
No-one will be able to help if they can't see the problem.
As long as it doesn't overstep the character boundaries and its nicely formatted its not too much for anyone to go through and read.
No-one will be able to help if they can't see the problem.
As long as it doesn't overstep the character boundaries and its nicely formatted its not too much for anyone to go through and read, be sure to post what errors pop up and which lines they point to
Topic archived. No new replies allowed.