calling a function from another class.

Hi, I am trying to implement this code, but getting error like this-use of undeclared identifiers.
In this line of code is showing errors:- compare_edge_points
std::nth_element(edge_points.begin(), edge_points.end() - edge_points.size() * c.edge_points_percent, edge_points.end(),Camera::compare_edge_points);/*this is showing error*/
Below is the code

Header file- Main.h
#ifndef main_h
#define main_h
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdint.h>
#include <stdlib.h>
#include <cmath>
#include <float.h>
#include <deque>
#include <algorithm>
#include <sys/time.h>
#include "optionparser.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>


class Camera {
public:

struct int16_image_t {
uint32_t w;
uint32_t h;
int16_t *data;
};
typedef struct int16_image_t int16_image_t;

struct meniscus_finder_context {

int16_image_t *outward_y_image;
int16_image_t *dot_product_image;
};

struct edge_point_t {
uint32_t i;
uint32_t j;
double_t v;
};
typedef struct edge_point_t edge_point_t;

bool compare_edge_points(edge_point_t *a,edge_point_t *b);
std::deque<edge_point_t *> find_edge_points(meniscus_finder_context &c);



Cpp file
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdint.h>
#include <stdlib.h>
#include <cmath>
#include <float.h>
#include <deque>
#include <algorithm>
#include <sys/time.h>
#include "optionparser.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
bool Camera :: compare_edge_points(edge_point_t *a,edge_point_t *b) {
return (a->v < b->v);
}

std::deque<Camera::edge_point_t *> find_edge_points(Camera::meniscus_finder_context &c) {
std::deque<Camera::edge_point_t *> edge_points;

std::nth_element(edge_points.begin(), edge_points.end() - edge_points.size() * c.edge_points_percent, edge_points.end(),Camera::compare_edge_points);/*this is showing error*/

return edge_points;
}
Did you declare your variables:
1
2
outward_y_image
dot_product_image


I don't see those variables declared any where in your snippet of code.

Also please remember to use the code tags.

~Hirokachi
Topic archived. No new replies allowed.