I am trying to create a C++ plugin (through a .dll) for Unity in order to use an haptic device. I am using Visual Studio Community 2017. I already wrote some code but I am not able to compile it because when i try i get "undeclared identifier" errors for the classes i defined in the functions prototype, as you can find below. My biggest concern relies on the fact that IntelliSense correctly recognizes everything as what it is meant to be, so i have no idea of what may be the problem. I am aware that it might be something very simple and stupid, but i am completely stuck here.
Righ now i have a header which is something like:
#ifndef PLUGIN_HEADER
#define PLUGIN_HEADER
#define APIENTRY __declspec(dllexport)
#include <Windows.h>
#include <iostream>
#include <map>
/* a bunch of other includes */
#include "RenderableClass.h"
#include "AuxClass.h"
extern "C" {
/*ERROR COMES UP IN THE FOLLOWING LINE*/
APIENTRY void PluginInitialization(AuxClass* aux);
APIENTRY void PluginCleanUp(AuxClass* aux);
};
#endif
and a source that looks like this
#include "header.h"
APIENTRY void PluginInitialization(AuxClass* aux)
{
/* Initialization of the haptic device */
}
APIENTRY void PluginCleanUp(AuxClass* aux)
{
/* memory release */
}
AuxClass and RenderableObject are basically just a bunch of attributes:
AuxClass.h:
#ifndef AUX_CLASS
#define AUX_CLASS
#include "header.h"
class AuxClass
{
public:
/*Attrtibutes*/
HHD m_hhd;
HHLRC m_hhlrc;
std::map<int, RenderableClass> m_objects;
AuxClass();
~AuxClass();
};
#endif // !AUX_CLASS
AuxClass.cpp is exactly this:
#include "AuxClass.h"
AuxClass::AuxClass(){ }
AuxClass::~AuxClass(){ }
Moreover, RenderableCLass.h and RenderableClass.cpp are respectively:
#ifndef RENDERABLE_CLASS
#define RENDERABLE_CLASS
#include "header.h"
class RenderableClass
{
public:
/*Attributes*/
int* m_triangles;
float* m_vertices;
int m_id;
/*other attributes*/
/*Methods*/
RenderableClass();
~RenderableClass();
};
and
#include "RenderableClass.h"
RenderableClass::RenderableClass(){ }
RenderableClass::~RenderableClass(){ }
The error i get is the following:
Error C2065 'AuxClass': undeclared identifier
and it is in the header, in the prototype of the first function, were i put the comment. () Does someone have some idea for a possible solution? Thanks in advance