I am trying to use a extern "C" function inside my header file for a c++ class.
When I compile I keep getting the error
duplicate symbol _currentInstance in:
main.o
GLHandler.o
I thought I had the right guards but can't seem to figure out why this is happening. Any help would be much appreciated.
Here is the header file.
#ifndef GLHANDLER_H
#define GLHANDLER_H
#include "LoadedObject.h"
#ifdef __cplusplus
extern "C" {
void displayCallback();
}
#endif
class GLHandler {
private:
LoadedObject *object;
public:
GLHandler(LoadedObject *);
void initializeVBO(LoadedObject *);
void renderObject(struct model *);
void displayFunction(void);
model *createModel(void);
void setupDisplayCallback();
};
GLHandler *currentInstance;
#ifdef __cplusplus
}
#endif
#endif
EDIT: Quickly pointed out by David, the extern GLHandler *currentInstance fixed the error.