Hey guys, I went from working with SDL to OpenGL now and have transferred some code from one project to another. I do not understand why I am getting an error with this:
"lib.h"
(I've read some where before that it is not good to use "using namespace std;" why is this?)
"world.h"
"object.h"
So the errors that it shows are:
'OBJECT' was not declared in this scope
ISO C++ forbids declaration of 'objects' with no type
I know the 2nd error there is because vector<OBJECT> is getting messed up so it doesn't have a type.
Any help with this would be great because I have been looking over this for a while now and it is just making me angry =(.
Thanks.
"lib.h"
Code:
#ifndef LIB_H #define LIB_H #include <windows.h> #include <gl\gl.h> #include <vector> #include <string> #include <fstream> #include <stdio.h> #include <math.h> using namespace std; #include "globals.h" #include "functions.h" #include "createwindowforgl.h" #include "bmp.h" #include "draw.h" #include "object.h" #include "world.h" #endif
"world.h"
Code:
#ifndef WORLD_H
#define WORLD_H
#include "object.h"
class WORLD
{
public:
vector<OBJECT>objects;
};
#endif
Code:
#ifndef OBJECT_H
#define OBJECT_H
#include "lib.h"
class OBJECT
{
struct VERTEX
{
float x, y, z;
float u, v;
};
GLuint surface;
vector<VERTEX> vertex;
public:
OBJECT(string xSurface);
void addVertex( float x, float y, float z, float u, float v );
VERTEX getVertex(int x)
{
return vertex[x];
}
GLuint getSurface();
};
#endif
'OBJECT' was not declared in this scope
ISO C++ forbids declaration of 'objects' with no type
I know the 2nd error there is because vector<OBJECT> is getting messed up so it doesn't have a type.
Any help with this would be great because I have been looking over this for a while now and it is just making me angry =(.
Thanks.
Comment