没有此构造函数的实例

时间:2015-12-06 00:18:23

标签: c++ opengl glew

所以我正在为OpenGL程序制作一个Camera类,并且我遇到了基本的C ++代码,我不允许用值初始化它。我的实现如下:

class Camera{

public:
    Camera();
    Camera(vec3 pos(), vec3 fron(), vec3 up(), GLfloat y, GLfloat p, GLfloat r);

    ...
};

Camera::Camera(vec3 pos(), vec3 fron(), vec3 up(), GLfloat y, GLfloat p, GLfloat r)
{
    cout << "Hello World" << endl;
}

剩下的就在我的主要内容中:

int main(){

    GLfloat lastx = width/2.0f;
    GLfloat lasty = height/2.0f; 
    GLfloat yaw = 90.0f;  //yaw set to -90 because yaw of 0.0 points to right or something wierd happens in euler angles
    GLfloat pitch = 0.0f;
    vec3 camerapos = vec3(0.0f, 0.5f, -10.0f);
    vec3 camerafront = vec3(0.0f, 0.5f, 1.0f);
    vec3 cameraup = vec3(0.0f, 1.0f, 0.0f);
    Camera cam(camerapos, camerafront, cameraup, yaw, pitch, GLfloat(0.0f));
}

奇怪的是,我尝试将其初始化为空,并填充它(使用相同的功能,请注意),但我将其称为init()。那时,我被告知该变量必须有一个Classtype。

任何明显盯着我的东西都显得很明显?

1 个答案:

答案 0 :(得分:2)

在此声明中:

pos

您将fronupvec3声明为函数(不带参数并返回Camera(vec3 pos, vec3 fron, vec3 up, GLfloat y, GLfloat p, GLfloat r); )。

删除括号(在声明和定义中):

Artist
相关问题