.dll Diving

PeriapsisPrograde

Wannabe addon dev
Joined
Mar 29, 2011
Messages
406
Reaction score
0
Points
16
Location
In orbit
Screw dumpsters.

I'm never going to do this without some help, so...

I want to make a simple .dll vessel. A simple one. One that could be done via config file. Just to get the hang of it. I sorta know what I'm doing, but then, I sorta don't in C++.

So here goes. I hope Martin is okay with my (ab)using the ShuttlePB sample in the SDK :cheers: After some minor changes, I have:

Code:
// Shuttle PB code edited by PeriapsisPrograde
// Much credit goes Dr. Schweiger vvv
// ==============================================================
//                 ORBITER MODULE: ShuttlePB
//                  Part of the ORBITER SDK
//          Copyright (C) 2002-2004 Martin Schweiger
//                   All rights reserved
//
// ShuttlePB.cpp
// Control module for ShuttlePB vessel class
//
// Notes:
// This is an example for a "minimal" vessel implementation which
// only overloads the clbkSetClassCaps method to define vessel
// capabilities and otherwise uses the default VESSEL class
// behaviour.
// ==============================================================

#define STRICT
#define ORBITER_MODULE

#include "orbitersdk.h"

// ==============================================================
// Some vessel parameters
// ==============================================================
const double  PB_SIZE       = 14;             // mean radius [m]
const VECTOR3 PB_CS         = {40,40,40}; // x,y,z cross sections [m^2]
const VECTOR3 PB_PMI        = {5,5,5};// principal moments of inertia (mass-normalised) [m^2]
const VECTOR3 PB_RD         = {0.025,0.025,0.02};//{0.05,0.1,0.05};  // rotation drag coefficients
const double  PB_EMPTYMASS  = 62e3;           // empty vessel mass [kg]
const double  PB_FUELMASS   = 1400;           // max fuel mass [kg]
const double  PB_ISP        = 3500;             // fuel-specific impulse [m/s]
const VECTOR3 PB_TDP[3]     = {{0,-1.5,2},{-1,-1.5,-1.5},{1,-1.5,-1.5}}; // touchdown points [m]
const VECTOR3 PB_COP        = {0,0,0};//{0,0,-0.1};      // centre of pressure for airfoils [m]
const double  PB_VLIFT_C    = 2.0;             // chord length [m]
const double  PB_VLIFT_S    = 2.0;             // wing area [m^2]
const double  PB_VLIFT_A    = 2.5;             // wing aspect ratio
const double  PB_HLIFT_C    = 2.0;             // chord length [m]
const double  PB_HLIFT_S    = 1.5;             // wing area [m^2]
const double  PB_HLIFT_A    = 2.0;             // wing aspect ratio

const double  PB_MAXMAINTH  = 0;             
const double  PB_MAXHOVERTH = 0;
const double  PB_MAXRCSTH   = 1e3;

const VECTOR3 PB_DOCK_POS   = {0,2.5,0};      // docking port location [m]
const VECTOR3 PB_DOCK_DIR   = {0,1,0};         // docking port approach direction
const VECTOR3 PB_DOCK_ROT   = {0,0,-1};        // docking port alignment direction

// Calculate lift coefficient [Cl] as a function of aoa (angle of attack) over -Pi ... Pi
// Implemented here as a piecewise linear function
double LiftCoeff (double aoa)
{
	int i;
	const int nlift = 9;
	static const double AOA[nlift] = {-180*RAD,-60*RAD,-30*RAD,-1*RAD,15*RAD,20*RAD,25*RAD,60*RAD,180*RAD};
	static const double CL[nlift]  = {       0,      0,   -0.1,     0,   0.2,  0.25,   0.2,     0,      0};
	static const double SCL[nlift] = {(CL[1]-CL[0])/(AOA[1]-AOA[0]), (CL[2]-CL[1])/(AOA[2]-AOA[1]),
		                              (CL[3]-CL[2])/(AOA[3]-AOA[2]), (CL[4]-CL[3])/(AOA[4]-AOA[3]),
									  (CL[5]-CL[4])/(AOA[5]-AOA[4]), (CL[6]-CL[5])/(AOA[6]-AOA[5]),
									  (CL[7]-CL[6])/(AOA[7]-AOA[6]), (CL[8]-CL[7])/(AOA[8]-AOA[7])};
	for (i = 0; i < nlift-1 && AOA[i+1] < aoa; i++);
	return CL[i] + (aoa-AOA[i])*SCL[i];
}

// ==============================================================
// Shuttle-PB class interface
// ==============================================================

class ShuttlePB: public VESSEL3 {
public:
	ShuttlePB (OBJHANDLE hVessel, int flightmodel);
	~ShuttlePB ();
	void clbkSetClassCaps (FILEHANDLE cfg);

private:
	static void vlift (VESSEL *v, double aoa, double M, double Re,
		void *context, double *cl, double *cm, double *cd);
	static void hlift (VESSEL *v, double aoa, double M, double Re,
		void *context, double *cl, double *cm, double *cd);
};

ShuttlePB::ShuttlePB (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
}

ShuttlePB::~ShuttlePB ()
{
}

// animation transformation definitions


// ==============================================================
// Overloaded callback functions
// ==============================================================

// --------------------------------------------------------------
// Set the capabilities of the vessel class
// --------------------------------------------------------------
void ShuttlePB::clbkSetClassCaps (FILEHANDLE cfg)
{
	THRUSTER_HANDLE th_main, th_hover, th_rcs[16], th_group[2];

	// physical vessel parameters
	SetSize (PB_SIZE);
	SetEmptyMass (PB_EMPTYMASS);
	SetPMI (PB_PMI);
	SetCrossSections (PB_CS);
	SetRotDrag (PB_RD);
	SetTouchdownPoints (PB_TDP[0], PB_TDP[1], PB_TDP[2]);

	// docking port definitions
	SetDockParams (PB_DOCK_POS, PB_DOCK_DIR, PB_DOCK_ROT);

	// propellant resources
	PROPELLANT_HANDLE hpr = CreatePropellantResource (PB_FUELMASS);

	// main engine
	// hover engine
	// RCS engines
	th_rcs[ 0] = CreateThruster (_V( 0, 2,-6), _V( 0,-1, 0), PB_MAXRCSTH, hpr, PB_ISP); //pitchup ^^
	th_rcs[ 1] = CreateThruster (_V( 0,-2, 6), _V( 0, 1, 0), PB_MAXRCSTH, hpr, PB_ISP); //pitchup ^^
	th_rcs[ 2] = CreateThruster (_V( 0, 2, 6), _V( 0,-1, 0), PB_MAXRCSTH, hpr, PB_ISP); //pitchdn vv
	th_rcs[ 3] = CreateThruster (_V( 0,-2,-6), _V( 0, 1, 0), PB_MAXRCSTH, hpr, PB_ISP); //pitchdn vv
	th_rcs[ 4] = CreateThruster (_V( 6, 2, 0), _V( 0,-1, 0), PB_MAXRCSTH, hpr, PB_ISP); //banklt 
	th_rcs[ 5] = CreateThruster (_V(-6,-2, 0), _V( 0, 1, 0), PB_MAXRCSTH, hpr, PB_ISP); //banklt
	th_rcs[ 6] = CreateThruster (_V(-6, 2, 0), _V( 0,-1, 0), PB_MAXRCSTH, hpr, PB_ISP); //bankrt
	th_rcs[ 7] = CreateThruster (_V( 6,-2, 0), _V( 0, 1, 0), PB_MAXRCSTH, hpr, PB_ISP); //bankrt
	th_rcs[ 8] = CreateThruster (_V(-6, 0,-2), _V( 0, 0, 1), PB_MAXRCSTH, hpr, PB_ISP); //yawrt >>
	th_rcs[ 9] = CreateThruster (_V( 6, 0, 2), _V( 0, 0,-1), PB_MAXRCSTH, hpr, PB_ISP); //yawrt >>
	th_rcs[10] = CreateThruster (_V( 6, 0,-2), _V( 0, 0, 1), PB_MAXRCSTH, hpr, PB_ISP); //yawlt <<
	th_rcs[11] = CreateThruster (_V(-6, 0, 2), _V( 0, 0,-1), PB_MAXRCSTH, hpr, PB_ISP); //yawlt <<

	th_group[0] = th_rcs[0];
	th_group[1] = th_rcs[1];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_PITCHUP);

	th_group[0] = th_rcs[2];
	th_group[1] = th_rcs[3];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_PITCHDOWN);

	th_group[0] = th_rcs[4];
	th_group[1] = th_rcs[5];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_BANKLEFT);

	th_group[0] = th_rcs[6];
	th_group[1] = th_rcs[7];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_BANKRIGHT);

	th_group[0] = th_rcs[1];
	th_group[1] = th_rcs[3];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_UP);
	//STOPPED HERE for now =========================================
	th_group[0] = th_rcs[1];
	th_group[1] = th_rcs[5];
	th_group[2] = th_rcs[3];
	th_group[3] = th_rcs[7];
	CreateThrusterGroup (th_group, 4, THGROUP_ATT_DOWN);

	th_group[0] = th_rcs[8];
	th_group[1] = th_rcs[11];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWLEFT);

	th_group[0] = th_rcs[9];
	th_group[1] = th_rcs[10];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_YAWRIGHT);

	th_group[0] = th_rcs[8];
	th_group[1] = th_rcs[10];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_LEFT);

	th_group[0] = th_rcs[9];
	th_group[1] = th_rcs[11];
	CreateThrusterGroup (th_group, 2, THGROUP_ATT_RIGHT);

	CreateThrusterGroup (th_rcs+12, 1, THGROUP_ATT_FORWARD);
	CreateThrusterGroup (th_rcs+13, 1, THGROUP_ATT_BACK);

	// camera parameters
	SetCameraOffset (_V(0,0.8,0));

	// associate a mesh for the visual
	AddMesh ("ShuttlePB");
}

// ==============================================================
// Airfoil lift/drag functions
// ==============================================================

void ShuttlePB::vlift (VESSEL *v, double aoa, double M, double Re,
	void *context, double *cl, double *cm, double *cd)
{
	static const double clp[] = {  // lift coefficient from -pi to pi in 10deg steps
		-0.1,-0.5,-0.4,-0.1,0,0,0,0,0,0,0,0,0,0,-0.2,-0.6,-0.6,-0.4,0.2,0.5,0.9,0.8,0.2,0,0,0,0,0,0,0,0,0,0.1,0.4,0.5,0.3,-0.1,-0.5
	};
	static const double aoa_step = 10.0*RAD;
	double a, fidx, saoa = sin(aoa);
	a = modf((aoa+PI)/aoa_step, &fidx);
	int idx = (int)(fidx+0.5);
	*cl = clp[idx]*(1.0-a) + clp[idx+1]*a;     // linear interpolation
	*cm = 0.0; //-0.03*sin(aoa-0.1);
	*cd = 0.03 + 0.4*saoa*saoa;                // profile drag
	*cd += oapiGetInducedDrag (*cl, 1.0, 0.5); // induced drag
	*cd += oapiGetWaveDrag (M, 0.75, 1.0, 1.1, 0.04);  // wave drag
}

void ShuttlePB::hlift (VESSEL *v, double aoa, double M, double Re,
	void *context, double *cl, double *cm, double *cd)
{
	static const double clp[] = {  // lift coefficient from -pi to pi in 45deg steps
		0,0.4,0,-0.4,0,0.4,0,-0.4,0,0.4
	};
	static const double aoa_step = 45.0*RAD;
	double a, fidx;
	a = modf((aoa+PI)/aoa_step, &fidx);
	int idx = (int)(fidx+0.5);
	*cl = clp[idx]*(1.0-a) + clp[idx+1]*a;     // linear interpolation
	*cm = 0.0;
	*cd = 0.03;
	*cd += oapiGetInducedDrag (*cl, 1.5, 0.6); // induced drag
	*cd += oapiGetWaveDrag (M, 0.75, 1.0, 1.1, 0.04);  // wave drag
}

// ==============================================================
// API callback interface
// ==============================================================

// --------------------------------------------------------------
// Vessel initialisation
// --------------------------------------------------------------
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
	return new ShuttlePB (hvessel, flightmodel);
}


// --------------------------------------------------------------
// Vessel cleanup
// --------------------------------------------------------------
DLLCLBK void ovcExit (VESSEL *vessel)
{
	if (vessel) delete (ShuttlePB*)vessel;
}

Compiling the .cpp file comes through:
Code:
1>------ Build started: Project: LeisurePod, Configuration: Debug Win32 ------
1>  Lpod.cpp
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(105): warning C4101: 'th_main' : unreferenced local variable
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(105): warning C4101: 'th_hover' : unreferenced local variable
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(160): warning C4789: destination of memory copy is too small
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

However, building it does not.
Code:
1>------ Build started: Project: LeisurePod, Configuration: Debug Win32 ------
1>     Creating library C:\Users\Jill\Documents\Visual Studio 2010\Projects\LeisurePod\Debug\LeisurePod.lib and object C:\Users\Jill\Documents\Visual Studio 2010\Projects\LeisurePod\Debug\LeisurePod.exp
1>Lpod.obj : error LNK2019: unresolved external symbol "void __cdecl dummy(void)" (?dummy@@YAXXZ) referenced in function "void __cdecl calldummy(void)" (?calldummy@@YAXXZ)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall VESSEL3::VESSEL3(void *,int)" (__imp_??0VESSEL3@@QAE@PAXH@Z) referenced in function "public: __thiscall ShuttlePB::ShuttlePB(void *,int)" (??0ShuttlePB@@QAE@PAXH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkSaveState(void *)" (?clbkSaveState@VESSEL2@@UAEXPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkLoadStateEx(void *,void *)" (?clbkLoadStateEx@VESSEL2@@UAEXPAX0@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkSetStateEx(void const *)" (?clbkSetStateEx@VESSEL2@@UAEXPBX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkPostCreation(void)" (?clbkPostCreation@VESSEL2@@UAEXXZ)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkFocusChanged(bool,void *,void *)" (?clbkFocusChanged@VESSEL2@@UAEX_NPAX1@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkPreStep(double,double,double)" (?clbkPreStep@VESSEL2@@UAEXNNN@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkPostStep(double,double,double)" (?clbkPostStep@VESSEL2@@UAEXNNN@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkPlaybackEvent(double,double,char const *,char const *)" (?clbkPlaybackEvent@VESSEL2@@UAE_NNNPBD0@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkVisualCreated(void *,int)" (?clbkVisualCreated@VESSEL2@@UAEXPAXH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkVisualDestroyed(void *,int)" (?clbkVisualDestroyed@VESSEL2@@UAEXPAXH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkDrawHUD(int,struct HUDPAINTSPEC const *,struct HDC__ *)" (?clbkDrawHUD@VESSEL2@@UAEXHPBUHUDPAINTSPEC@@PAUHDC__@@@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkRCSMode(int)" (?clbkRCSMode@VESSEL2@@UAEXH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkADCtrlMode(unsigned long)" (?clbkADCtrlMode@VESSEL2@@UAEXK@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkHUDMode(int)" (?clbkHUDMode@VESSEL2@@UAEXH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkMFDMode(int,int)" (?clbkMFDMode@VESSEL2@@UAEXHH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkNavMode(int,bool)" (?clbkNavMode@VESSEL2@@UAEXH_N@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkDockEvent(int,void *)" (?clbkDockEvent@VESSEL2@@UAEXHPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL2::clbkAnimate(double)" (?clbkAnimate@VESSEL2@@UAEXN@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall VESSEL2::clbkConsumeDirectKey(char *)" (?clbkConsumeDirectKey@VESSEL2@@UAEHPAD@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall VESSEL2::clbkConsumeBufferedKey(unsigned long,bool,char *)" (?clbkConsumeBufferedKey@VESSEL2@@UAEHK_NPAD@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkLoadGenericCockpit(void)" (?clbkLoadGenericCockpit@VESSEL2@@UAE_NXZ)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkLoadPanel(int)" (?clbkLoadPanel@VESSEL2@@UAE_NH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkPanelMouseEvent(int,int,int,int)" (?clbkPanelMouseEvent@VESSEL2@@UAE_NHHHH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkPanelRedrawEvent(int,int,void *)" (?clbkPanelRedrawEvent@VESSEL2@@UAE_NHHPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkLoadVC(int)" (?clbkLoadVC@VESSEL2@@UAE_NH@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkVCMouseEvent(int,int,union VECTOR3 &)" (?clbkVCMouseEvent@VESSEL2@@UAE_NHHAATVECTOR3@@@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL2::clbkVCRedrawEvent(int,int,void *)" (?clbkVCRedrawEvent@VESSEL2@@UAE_NHHPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL3::clbkPanelMouseEvent(int,int,int,int,void *)" (?clbkPanelMouseEvent@VESSEL3@@UAE_NHHHHPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL3::clbkPanelRedrawEvent(int,int,void *,void *)" (?clbkPanelRedrawEvent@VESSEL3@@UAE_NHHPAX0@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall VESSEL3::clbkGeneric(int,int,void *)" (?clbkGeneric@VESSEL3@@UAEHHHPAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL3::clbkLoadPanel2D(int,void *,unsigned long,unsigned long)" (?clbkLoadPanel2D@VESSEL3@@UAE_NHPAXKK@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall VESSEL3::clbkDrawHUD(int,struct HUDPAINTSPEC const *,class oapi::Sketchpad *)" (?clbkDrawHUD@VESSEL3@@UAE_NHPBUHUDPAINTSPEC@@PAVSketchpad@oapi@@@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL3::clbkRenderHUD(int,struct HUDPAINTSPEC const *,void *)" (?clbkRenderHUD@VESSEL3@@UAEXHPBUHUDPAINTSPEC@@PAX@Z)
1>Lpod.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall VESSEL3::clbkGetRadiationForce(union VECTOR3 const &,union VECTOR3 &,union VECTOR3 &)" (?clbkGetRadiationForce@VESSEL3@@UAEXABTVECTOR3@@AAT2@1@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall VESSEL::AddMesh(char const *,union VECTOR3 const *)const " (__imp_?AddMesh@VESSEL@@QBEIPBDPBTVECTOR3@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetCameraOffset(union VECTOR3 const &)const " (__imp_?SetCameraOffset@VESSEL@@QBEXABTVECTOR3@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void * __thiscall VESSEL::CreateThrusterGroup(void * *,int,enum THGROUP_TYPE)const " (__imp_?CreateThrusterGroup@VESSEL@@QBEPAXPAPAXHW4THGROUP_TYPE@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void * __thiscall VESSEL::CreateThruster(union VECTOR3 const &,union VECTOR3 const &,double,void *,double,double,double)const " (__imp_?CreateThruster@VESSEL@@QBEPAXABTVECTOR3@@0NPAXNNN@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void * __thiscall VESSEL::CreatePropellantResource(double,double,double)const " (__imp_?CreatePropellantResource@VESSEL@@QBEPAXNNN@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetDockParams(union VECTOR3 const &,union VECTOR3 const &,union VECTOR3 const &)const " (__imp_?SetDockParams@VESSEL@@QBEXABTVECTOR3@@00@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetTouchdownPoints(union VECTOR3 const &,union VECTOR3 const &,union VECTOR3 const &)const " (__imp_?SetTouchdownPoints@VESSEL@@QBEXABTVECTOR3@@00@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetRotDrag(union VECTOR3 const &)const " (__imp_?SetRotDrag@VESSEL@@QBEXABTVECTOR3@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetCrossSections(union VECTOR3 const &)const " (__imp_?SetCrossSections@VESSEL@@QBEXABTVECTOR3@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetPMI(union VECTOR3 const &)const " (__imp_?SetPMI@VESSEL@@QBEXABTVECTOR3@@@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetEmptyMass(double)const " (__imp_?SetEmptyMass@VESSEL@@QBEXN@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall VESSEL::SetSize(double)const " (__imp_?SetSize@VESSEL@@QBEXN@Z) referenced in function "public: virtual void __thiscall ShuttlePB::clbkSetClassCaps(void *)" (?clbkSetClassCaps@ShuttlePB@@UAEXPAX@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) double __cdecl oapiGetWaveDrag(double,double,double,double,double)" (__imp_?oapiGetWaveDrag@@YANNNNNN@Z) referenced in function "private: static void __cdecl ShuttlePB::vlift(class VESSEL *,double,double,double,void *,double *,double *,double *)" (?vlift@ShuttlePB@@CAXPAVVESSEL@@NNNPAXPAN22@Z)
1>Lpod.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) double __cdecl oapiGetInducedDrag(double,double,double)" (__imp_?oapiGetInducedDrag@@YANNNN@Z) referenced in function "private: static void __cdecl ShuttlePB::vlift(class VESSEL *,double,double,double,void *,double *,double *,double *)" (?vlift@ShuttlePB@@CAXPAVVESSEL@@NNNPAXPAN22@Z)
1>C:\Users\Jill\Documents\Visual Studio 2010\Projects\LeisurePod\Debug\LeisurePod.dll : fatal error LNK1120: 50 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This could be a wild ride...

Thanks for any help! :cheers:


EDIT: I haven't forgotten about Sunrise Spaceport. It lost govt funding, but is still making slow development.
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
About warnings:
Code:
THRUSTER_HANDLE th_main, th_hover, th_rcs[16], th_group[2];
You don't use th_main & th_hover anywhere in the function yet, hence there are 2 warnings:
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(105): warning C4101: 'th_main' : unreferenced local variable
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(105): warning C4101: 'th_hover' : unreferenced local variable

The third warning -
1>c:\users\jill\documents\visual studio 2010\projects\leisurepod\lpod.cpp(160): warning C4789: destination of memory copy is too small
- is related to th_group, which is declared as 2 element array, and there will be defined only th_group[0] & th_group[1] elements at the runtime. Writing to an element of index beyond that will cause problems, and you have:
Code:
th_group[2] = th_rcs[3];
th_group[3] = th_rcs[7];
If th_group[3] is the last element, You need to declare the th_group as 4 element array, i.e. th_group[4].


The linker errors are caused by missing dependencies - Orbiter.lib & Orbitersdk.lib. You need to add those libraries to additional dependencies in your project.

How to do it was explained many times on forums, so simple forum search should reveal you at least 2 methods how you can do it.
 

PeriapsisPrograde

Wannabe addon dev
Joined
Mar 29, 2011
Messages
406
Reaction score
0
Points
16
Location
In orbit
Well, that didn't quite work... :shrug:
Code:
1>------ Build started: Project: LeisurePod, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'C:\Users\Jill\Documents\Orbiter2010\Orbitersdk\lib.obj'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Closer, though! :)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,615
Reaction score
2,335
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Not closer - further away in the oceans of half-wit.

You want to include the following static libraries from the folder "OrbiterSDK/lib" :

Orbiter.lib
OrbiterSDK.lib
 
Top