[Error] no matching function for call to

I'm new at C++ and I am messing around with matrices. However I keep receiving error such as:
[Error] no matching function for call to 'matrixlib::matrix::addMatrices(double&, double&, double&)'

With such comments as the one below:
[Note] candidate is:
In file included from main.cpp
[Note] static void matrixlib::matrix::addMatrices(double (*)[4], double (*)[4], double (*)[4])
[Note] no known conversion for argument 1 from 'double' to 'double (*)[4]'

This means it's not calling from my header file properly correct? How do I get it to do so?

main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>
#include "matrixlib.h"
using namespace std;

int main ()
{
  string menu;
  double a[4][4], b[4][4], result[4][4];

//code relating to "menu" here.

if (menu == "2")
    {
       matrixlib::matrix::addMatrices(result[4][4],a[4][4],b[4][4]) 
     }}


matrixlib.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include "matrixlib.h"
using namespace matrixlib;

void matrixlib::matrix::addMatrices( double result[4][4], double a[4][4], double b[4][4])
	{
	for(int i=0;i<4;i++)
	for(int j=0;j<4;j++)
		{
		a[i][j]+b[i][j]=result[i][j];
		}
		for(int i=0;i<4;i++)
		for(int j=0;j<4;j++)
		cout << result[i][j]<< endl;		
    }  


matrixlib.h
1
2
3
4
5
6
7
8
9
10
#ifndef MATRIXLIB_H
#define MATRIXLIB_H

namespace matrixlib{
class matrix{
public:
	static void addMatrices(double result[4][4], double a[4][4], double b[4][4]);
};
}
#endif     	 
Last edited on
no known conversion for argument 1 from 'double' to 'double (*)[4]'


Your first argument is a double, but your function expects a double(*)[4].
Got it resolved. The line
 
 matrixlib::matrix::addMatrices(result[4][4],a[4][4],b[4][4])


had to be
 
 matrixlib::matrix::addMatrices(result,a,b)
Topic archived. No new replies allowed.