Q:

Opengl - GLfloat not being recognized

Having some trouble with this class declaration, Im trying to create nodes for an openGL implementation of Dijktra's shortest path algorithm. the getX(), getY(), getZ() methods cause an error:
error: ISO C++ forbids declaration of ‘getX’ with no type
Im compiling with g++ on ubuntu linux. Command: g++ -lglut -lGLU -lGL projecttest.c
#include <cstdarg>
#include <cstdio>
#include <GL/glut.h>
#include <GL/glu.h>
#include <cstdlib> 
#include <iostream>
#define kWindowWidth 800
#define kWindowHeight 600 
#define NUM_NODES 3

using namespace std;

class Node {
    private: 
        GLfloat x, y, z;
        int numLinks;
        Node *links[];
    public: 
        Node(GLfloat x, GLfloat y, ...);
        ~Node();
        GLfloat getX();
        GLfloat getY();
        GLfloat getZ() {return 0.0f;}
} Node;

Node nodes_g[NUM_NODES];

I think the problem is in the preprocessor macros. Im new to openGL and somewhat new to c++ so any advice is good, but what I really want to know is why im getting the error.

A:

You need
#include <GL/gl.h>

before including headers for OpenGL extensions.

