tauruslittrow84
New member
- Joined
- Nov 12, 2011
- Messages
- 58
- Reaction score
- 0
- Points
- 0
When I use this code
I get all these errors when trying to create a spotlight module. What have I forgotten in my header?
Here is my entire code:
Code:
docking_light = (SpotLight*)AddSpotLight(_V(0.0,-1.022404,12.6), _V(0,0,1), 150, 1e-3, 0, 1e-3, RAD*25, RAD*60, col_white, col_white, col_a);
docking_light->Activate(true);
Code:
>spotlamp.cpp
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.h(12) : warning C4005: 'STRICT' : macro redefinition
1> c:\program files\microsoft sdks\windows\v6.0a\include\windef.h(16) : see previous definition of 'STRICT'
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(31) : error C2065: 'docking_light' : undeclared identifier
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(31) : error C2065: 'col_white' : undeclared identifier
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(31) : error C2065: 'col_white' : undeclared identifier
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(31) : error C2065: 'col_a' : undeclared identifier
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(31) : error C3861: 'AddSpotLight': identifier not found
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(32) : error C2065: 'docking_light' : undeclared identifier
1>c:\users\crice\documents\visual studio 2008\projects\spotlamp\spotlamp\spotlamp.cpp(32) : error C2227: left of '->Activate' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>Build log was saved at "file://c:\Users\crice\Documents\Visual Studio 2008\Projects\spotlamp\spotlamp\Debug\BuildLog.htm"
1>spotlamp - 7 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is my entire code:
Code:
#include <OrbiterAPI.h>
#include "spotlamp.h"
#include "OrbiterSDK.h"
// ==============================================================
// Some vessel parameters
// ==============================================================
const double MASS = 5;
// ==============================================================
// Overloaded callback functions
// ==============================================================
// --------------------------------------------------------------
// Set the capabilities of the vessel class
// --------------------------------------------------------------
void spotlamp::clbkSetClassCaps (FILEHANDLE cfg)
{
docking_light = (SpotLight*)AddSpotLight(_V(0.0,-1.022404,12.6), _V(0,0,1), 150, 1e-3, 0, 1e-3, RAD*25, RAD*60, col_white, col_white, col_a);
docking_light->Activate(true);
SetTouchdownPoints (_V(3.08,-4.5,-.534),_V(3.08,0,-.534),_V(3.08,4.5,-.534));
// visual specs
AddMesh ("spotlamp");
}
// --------------------------------------------------------------
// Save/load vessele state to/from scenario
// --------------------------------------------------------------
void spotlamp::clbkLoadStateEx (FILEHANDLE scn, void *vs)
{ //commented code is for reference only
char *line;
while (oapiReadScenario_nextline (scn, line)) {
//if (!strnicmp (line, "SOMEPARAM", 9)) {
// sscanf (line+9, "%lf", somevar);
//} else {
ParseScenarioLineEx (line, vs);
// unrecognised option - pass to Orbiter's generic parser
//}
}
}
void spotlamp::clbkSaveState (FILEHANDLE scn)
{ //commented code is for reference only
//char cbuf[256];
// default vessel parameters
VESSEL2::clbkSaveState (scn);
// custom parameters
//sprintf (cbuf, "%0.1f", somefloatpara,);
//oapiWriteScenario_string (scn, "SOMEPARAM", cbuf);
}
// --------------------------------------------------------------
// Called at each simulation time step before the state is updated
// --------------------------------------------------------------
void spotlamp::clbkPreStep (double simt, double simdt, double mjd)
{ //do something
}
// --------------------------------------------------------------
//Keyboard state handler. Check OrbiterAPI reference for details
// --------------------------------------------------------------
int spotlamp::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate)
{ return 0;
}
// ==============================================================
// API callback interface
// ==============================================================
// --------------------------------------------------------------
// Vessel initialisation
// --------------------------------------------------------------
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new spotlamp (hvessel, flightmodel);
}
// --------------------------------------------------------------
// Vessel cleanup
// --------------------------------------------------------------
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (spotlamp*)vessel;
}