Jan 10, 2017 at 10:17pm UTC
Hi
1 2 3 4 5 6 7 8 9 10 11
class Camera
{
double mouseposx = 0, mouseposy = 0;
double xzdir = 0, ydir = 0, x, y, z;
public :
void Camera(void )
{
glfwGetCursorPos(window, &mouseposx, &mouseposy);
cout << mouseposx << " " << mouseposy;
};
};
return type specification for constructor invalid
-- line 6
Last edited on Jan 10, 2017 at 10:18pm UTC
Jan 10, 2017 at 10:36pm UTC
A constructor and destructor have no return types.
1 2 3 4 5
Camera()
{
glfwGetCursorPos(window, &mouseposx, &mouseposy);
cout << mouseposx << " " << mouseposy;
};
And normally in C++ if a function has no parameters you use empty parentheses(), not (void).
Last edited on Jan 10, 2017 at 10:37pm UTC
Jan 10, 2017 at 11:29pm UTC
I dont want a constructor, I want just a function that works with that object. I put void there, hoping may solv the problem, because I saw people usong it
Jan 10, 2017 at 11:31pm UTC
Ups, I just realised, how blind I'm, I gave the funtion the same name...as the class...........