Hello guys, I'm trying to compile a simple module following the API_Guide.
That's the code:
when trying to compile it gives me the following:
Now...I think the reason for that is I have changed in orbiterAPI.h:
with
this because
gave me an error, marked in red on the code, more specifically:
same was happening for
with __DATE__ marked in red and which I changed with
So what do you think should I do? Am I missing something or doing something wrong?
Thanks in advance.
That's the code:
Code:
// Dll1.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
//======================
//Module initialisation
//======================
#define ORBITER_MODULE
#include "orbitersdk.h"
HINSTANCE g_hDLL;
DLLCLBK void InitModule(HINSTANCE hModule)
{
g_hDLL = hModule;
// perform global module initialisation here
}
DLLCLBK void ExitModule(HINSTANCE hModule)
{
// perform module cleanup here
}
//======================
//Vessel initialisation
//======================
class MyVessel : public VESSEL2
{
public:
MyVessel(OBJHANDLE hObj, int fmodel) : VESSEL2(hObj, fmodel) {}
~MyVessel() {}
// add more vessel methods here
void clbkLoadStateEx(FILEHANDLE scn, void *status);
void clbkSaveState(FILEHANDLE scn);
void clbkSetClassCaps(FILEHANDLE cfg);
private:
double myparam;
};
void MyVessel::clbkLoadStateEx(FILEHANDLE scn, void *status)
{
char *line; while (oapiReadScenario_nextline(scn, line))
{
if (!_strnicmp(line, "MYPARAM", 7))
{
sscanf_s(line + 7, "%lf", &myparam);
}
else
{
ParseScenarioLineEx(line, status);
}
}
}
void MyVessel::clbkSaveState(FILEHANDLE scn)
{
VESSEL2::clbkSaveState(scn);
oapiWriteScenario_float(scn,"MYPARAM", myparam);
}
void MyVessel::clbkSetClassCaps(FILEHANDLE cfg)
{
SetEmptyMass(1000.0);
SetSize(10.0);
//AddMesh(oapiLoadMeshGlobal(“MyVessel.msh”));
// define vessel capabilities here
}
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new MyVessel (hvessel, flightmodel);
}
DLLCLBK void ovcExit(VESSEL *vessel)
{
if (vessel) delete (MyVessel*)vessel;
}
when trying to compile it gives me the following:
Code:
Dll1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl oapiWriteScenario_float(void *,char const *,double)" (__imp_?oapiWriteScenario_float@@YAXPAXPBDN@Z)
Now...I think the reason for that is I have changed in orbiterAPI.h:
Code:
OAPIFUNC void oapiWriteScenario_float (FILEHANDLE scn, char *item, double d);
Code:
OAPIFUNC void oapiWriteScenario_float (FILEHANDLE scn,const char *item, double d);
Code:
oapiWriteScenario_float(scn,"MYPARAM", myparam);
Code:
argument of type "const char*" is incompatible with parameter of type "char*"
same was happening for
Code:
#ifdef ORBITER_MODULE
void dummy();
void calldummy () { dummy(); }
DLLCLBK char *ModuleDate () { return __DATE__; }
#endif
Code:
#ifdef ORBITER_MODULE
void dummy();
void calldummy () { dummy(); }
DLLCLBK const char *ModuleDate () { return __DATE__; }
#endif
So what do you think should I do? Am I missing something or doing something wrong?
Thanks in advance.