Matrix3f and Vector3f Error in Quaternion.h Library


I was wondering if anyone could point me in the right direction to solve the error I receive when I add the quaternion.h file to an arduino sketch. I’m using the arduino web editor. I was able to upload the file, but I get an error when it is compiled. This is the first time I have added a library. I get the following error:

Arduino Due Programming Port
Using library libraries in folder: /tmp/726364844/custom/libraries (legacy)

In file included from /tmp/726364844/sketch_dec7a/sketch_dec7a.ino:2:0:

/tmp/726364844/custom/libraries/quaternion.h:37:23: error: ‘Matrix3f’ has not been declared

void rotation_matrix(Matrix3f &m);


/tmp/726364844/custom/libraries/quaternion.h:40:21: error: ‘Vector3f’ has not been declared

void earth_to_body(Vector3f &v);


exit status 1

// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-

// Copyright 2012 Andrew Tridgell, all rights reserved.

//	This library is free software; you can redistribute it and / or
//	modify it under the terms of the GNU Lesser General Public
//	License as published by the Free Software Foundation; either
//	version 2.1 of the License, or (at your option) any later version.


#include <math.h>

class Quaternion
	float q1, q2, q3, q4;

	// constructor creates a quaternion equivalent
	// to roll=0, pitch=0, yaw=0
	Quaternion() { q1 = 1; q2 = q3 = q4 = 0; }

	// setting constructor
	Quaternion(const float _q1, const float _q2, const float _q3, const float _q4):
	q1(_q1), q2(_q2), q3(_q3), q4(_q4) {}

	// function call operator
	void operator ()(const float _q1, const float _q2, const float _q3, const float _q4)
	{ q1 = _q1; q2 = _q2; q3 = _q3; q4 = _q4; }

	// check if any elements are NAN
	bool is_nan(void)
	{   return isnan(q1) || isnan(q2) || isnan(q3) || isnan(q4); }

	// return the rotation matrix equivalent for this quaternion
	void rotation_matrix(Matrix3f &m);

	// convert a vector from earth to body frame
	void earth_to_body(Vector3f &v);

    // create a quaternion from Euler angles
	void from_euler(float roll, float pitch, float yaw);

    // create eulers from a quaternion
	void to_euler(float *roll, float *pitch, float *yaw);
#endif // QUATERNION_H
// libraries - Version: Latest 
#include <quaternion.h>



void setup() {

void loop() {

Well, do you see any definitions of Vector3f or Matrix3F? I do not.

Post a link to where you got the library from. Please use the chain links icon on the forum toolbar to make it clickable. Or if you installed it using Library Manger (Libraries > Library Manager) then say so and state the full name of the library.