hi i am new to eclipse
i wrote a small programm in c++ using operator overloading
if i compile normally no error but if compile through eclipse it is giving erorr message like
"operator not mached "
/*************************************************************/
this my main.cpp
************************************************************/
#include <iostream>
#include"use.h"
#include"friend.h"
using namespace std;
int main()
{
cout<<"this is main"<<endl;
return 0;
}
/******************************************************/
friend.h
******************************************************/
#ifndef FRIEND_H_
#define FRIEND_H_
#include<vector>
using namespace std;
class FriendClass
{
friend vector < vector < float > > operator*(const vector < vector < float > > &m1,const vector < vector < float > > &m2);
public:
FriendClass();
virtual~FriendClass();
private:
};
#endif /*FRIEND_H_*/
/***************************************************************************/
use.h
***************************************************************************/
#ifndef USE_H_
#define USE_H_
#include"friend.h"
class useClass
{
friend vector < vector < float > > operator*(const vector < vector < float > > &,const vector < vector < float > > &); //Addition
public:
useClass();
virtual~useClass();
void usingFriend();
private:
};
#endif /*USE_H_*/
/***********************************************************************/
friend.cpp
************************************************************************/
#include "friend.h"
FriendClass::FriendClass()
{
}
FriendClass::~FriendClass()
{
}
vector < vector < float > > operator*(const vector < vector < float > > &m1,const vector < vector < float > > &m2)
{
int m,n,p,q;
m=m1.capacity();n=m1.at(0).capacity();
p=m2.capacity();q=m2.at(0).capacity();
vector < vector<float> >m3(m,vector <float>(q,0));
//(m*n) *(m*q)=(n*p)
if(n==p)
{
// vector < vector<float> >c(n,vector <float>(q,0));
for(int i=0;i<m;i++)
{
for(int j=0;j<q;j++)
{
for(int k=0;k<n;k++)
{
m3[i][j]=m3[i][j]+m1[i][k]*m2[k][j];
}
}
}
}
else
{
//cout<<"Multiplication not possible\n"<<endl;
}
return m3;
}
/************************************************************************************/
use.cpp
********************************************************************************/
#include"use.h"
useClass::useClass()
{
}
useClass::~useClass()
{
}
void useClass::usingFriend()
{
vector < vector < float > > Q(5, vector <float>(5,0)); // Q Matrix
vector < vector < float > > V(3, vector <float>(1,0)); // Process Noise Matrix
vector < vector < float > > Gamma(5, vector <float>(3,0)); // Gamma Matrix
Q=Q*Gamma;//(~V);//gving Error during eclipse compile Fornormal compilation no error
}