Hi
I want to declare a variable which is pointer to a class at my header.
here is my header:
base_functions.H
-----------------------------
#ifndef BASE_FUNCTIONS_H
#define BASE_FUNCTIONS_H
#ifndef BASIS
#define BASIS
#define DT 0.01
#include "weights.H"
#include <math.h>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
typedef struct basis_t
{
boost::numeric::ublas::matrix<float> cov;
boost::numeric::ublas::vector<float> mu;
float a;
float b;
float previous_b;
} basis;
#define ETA_C 0.1
#define ETA_M 0.1
#define INITIAL_VALUE 1.0
#define INITIAL_DELTA 1
class base_functions
{
private:
int N;
boost::numeric::ublas::matrix<float> diag
(boost::numeric::ublas::vector<float> v);
int function_num;
boost::numeric::ublas::vector<float> initial_cov;
basis* functions_vec;
C_weights* weights;
public:
base_functions(boost::numeric::ublas::vector<float >
covariance,C_weights* new_weights );
~base_functions();
int get_function_num();
bool build_new_function(float func_value, float delta);
void update(boost::numeric::ublas::vector<float> x);
float get_previous_b(int index);
float get_b(int index);
float get_max_a();
void compute_function(boost::numeric::ublas::vector<flo at> x);
};
#endif
#endif
and here is the interface of C_weight class
weights.H
-------------------
#ifndef WEIGHTS_H
#define WEIGHTS_H
#ifndef WEIGHT
#define WEIGHT
#define DT 0.01
#include "base_functions.H"
typedef struct weight_t
{
float current_value;
float prev_value;
}weight;
class C_weights
{
private:
weight* weights_vec;
public:
C_weights();
~C_weights();
float get_previous_weight(int i);
float get_current_wieght(int i);
void update_wieghts(float eta, float noise,base_functions* functions,
float delta);
bool new_weight(float func_value, float delta,int func_num);
//weight wheits_vec[0];
boost::numeric::ublas::matrix<weight> wghits_mat;
};
#endif
#endif
As you can see I tried to declare "C_weight* weights" at
base_function.H.
But when I compiled it I got the following error:
base_functions.H:66: error: ISO C++ forbids declaration of `C_weights'
with no type
base_functions.H:66: error: expected `;' before '*' token
base_functions.H:71: error: `C_weights' has not been declared
base_functions.H:71: error: ISO C++ forbids declaration of
`new_weights' with no type
I'm using Cygwin g++ 3.4.4
Thanks for your help.
Dvir