C++ C++;从函数返回GLM矩阵错误:必须具有类/结构/联合的左侧

C++ C++;从函数返回GLM矩阵错误:必须具有类/结构/联合的左侧,c++,glm-math,C++,Glm Math,我试图从java中使用的函数返回一个GLM矩阵,但是C++中它给了我一个“错误c2228:左边的”。 头文件 #ifndef MATHS_H #define MATHS_H #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <glew.h> #include <string>

我试图从java中使用的函数返回一个GLM矩阵,但是C++中它给了我一个“错误c2228:左边的”。 头文件

#ifndef MATHS_H
#define MATHS_H

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glew.h> 
#include <string>
#include <vector>

class Maths
{
public:

static glm::mat4 createTransformationMatrix(glm::vec3 translation, float 
       rx, float ry,float rz, float scale);
};
#endif
当我从这样的外部类调用此函数时,会发生错误。我不知道为什么这样做会出错

 glm::mat4 transformation = glm::mat4();
     transformation = Maths.createTransformationMatrix(      
 glm::vec3(entity.getPosition()),1,1,1,1);

与java相比,C++中使用静态成员的语法有点不同。在类名和静态成员名之间,必须使用作用域运算符

,如下所示:

transformation = Maths::createTransformationMatrix(
    glm::vec3(entity.getPosition()),1,1,1,1);

如果您有一个只有静态公共成员函数的类,那么请考虑使用<代码>命名空间< /代码>。然后阅读有关作用域运算符的信息
transformation = Maths::createTransformationMatrix(
    glm::vec3(entity.getPosition()),1,1,1,1);