I am getting the following error with g++ 4.9:
basis.cpp:16: undefined reference to `Basis::foo(int, int)'
This is the header file:
#ifndef BASIS_H
#define BASIS_H
#include "common.h"
#include <math.h>
#include "xdouble.h"
using namespace std;
class Basis {
private:
int rank;
int dim;
public:
Basis(); //Empty constructor
Basis(int r, int d); //Default constructor
void foo(int a, int b);
void bar(int a, int b);
};
#endif
The basis.cpp file is the following:
#include "basis.h"
Basis::Basis()
{
rank = 0;
dim = 0;
}
Basis::Basis(int r, int d) // Default constructor
{
rank = r;
dim = d;
}
void Basis::bar(int a, int b)
{
void foo(int a, int b);
}
void Basis::foo(int a, int b)
{
}
Even though I'm including the basis.h file I get the undefined reference error and I can't understand why this is happening. What am I doing wrong?
Thanks