Damn error message!!! C++ - Need help

Associate
Joined
26 Jun 2003
Posts
1,140
Location
North West
Im trying to compile my program and I have no idea what is causing this error.

I have a class "Button" with a constructor:

Button::Button(void)
{
// Stuff
}

In another class called "Interface" I include the above file and create 4 buttons using:

Button button1;
Button button2;
Button button3;
Button button4;

Im getting this error when compiling:

error: 'Button' is used as a type, but is not defined

What can be causing this error?

THx
 
Last edited:
Button.cpp: (in dir: "src/button.cpp")

#include "../include/button.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Button::Button(void) { }

Button::~Button(void) { }


-------------------------------


Button.h: ("include/button.h")

#ifndef _BUTTONH_
#define _BUTTONH_

#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

class Button
{

private:

int id;
int x;
int y;
char* string;

public:

Button(void);
~Button(void);

};

#endif
 
Tkink I fixed it.

On my main.h file I had a copy and paste noob error. I had done #define _BUTTONH_ on that so the header file for the Button class was not compiling. NOOB!!!! lol

Although I am now gettin these types of errors:

/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x1f): In function `__glXGetCurrentContext':
: undefined reference to `pthread_key_create'
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x3e): In function `__glXGetCurrentContext':
: undefined reference to `pthread_getspecific'
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x6f): In function `__glXSetCurrentContext':
: undefined reference to `pthread_setspecific'
/usr/X11R6/lib/libGL.a(glxext.o)(.text+0x87): In function `__glXSetCurrentContext':

Am i not including something?

---- FIXED ----

The above was due to me using an out of data Makefile.

Thx anyway

JD
 
Last edited:
Back
Top Bottom