OK, I'm working on making a static library to allow add-on makers to implement the jet engine in their code. I've pulled out the functions that calculate the engine thrust and Isp into a static library project organized as follows:
The library compiled without problem, and I made a new add-on project for the Mirage2000 where I am attempting to implement it using the library, but I get errors 'GetJetEngineThrust': identifier not found and 'GetJetEngineIsp': identifier not found.
I put the library JetEngine.lib in the OrbiterSDK/lib directory, and that directory is linked in the project properties. I also added it as a source along with Orbiter.lib and OrbiterSDK.lib, but it doesn't seem to help.
This is how I've tried to call these functions in my add-on code:
I'm really pushing my C++ capabilities here so I'm not quite sure what the problem is, or what's missing. Can anyone help me make sense of this? If I can get this to work this may be very close to ability to release it as an addon.
C++:
// JetEngineLibrary.cpp
#include <cmath>
#include "JetEngineLibrary.h"
namespace JetEngineLibrary
{
double JetEngine::GetJetEngineThrust(double throttle, bool afterburner, double M_0, double T_0, double P_0, double rho)
{
...
return thrust;
}
double JetEngine::GetJetEngineIsp(double throttle, double thrust)
{
...
return Isp;
}
}
C++:
//JetEngineLibrary.h
namespace JetEngineLibrary
{
class JetEngine
{
public:
static double GetJetEngineThrust(double throttle, bool afterburner, double M_0, double T_0, double P_0, double rho);
static double GetJetEngineIsp(double throttle, double thrust);
};
}
The library compiled without problem, and I made a new add-on project for the Mirage2000 where I am attempting to implement it using the library, but I get errors 'GetJetEngineThrust': identifier not found and 'GetJetEngineIsp': identifier not found.
I put the library JetEngine.lib in the OrbiterSDK/lib directory, and that directory is linked in the project properties. I also added it as a source along with Orbiter.lib and OrbiterSDK.lib, but it doesn't seem to help.
This is how I've tried to call these functions in my add-on code:
C++:
void Mirage2000::clbkPostStep(double simt, double simdt, double mjd)
{
//----JET ENGINE IMPLEMENTATION
//Get throttle input from user from dummy thruster
throttle = GetThrusterGroupLevel(thg_dummy);
//determine afterburner status
afterburner = false; //How is afterburner engaged in real jet?
// Get local flight conditions from Orbiter
M_0 = GetMachNumber(); //flight Mach number [-]
T_0 = GetAtmTemperature(); //ambient static temperature [K]
P_0 = GetAtmPressure(); //ambient static pressure [Pa absolute]
rho = GetAtmDensity(); //ambient atmospheric density [kg/cubic meter]
//Use inputs and flight conditions to calculate jet engine thrust and Isp
thrust = JetEngine::GetJetEngineThrust(throttle, afterburner, M_0, T_0, P_0, rho); //doesn't work
#thrust = GetJetEngineThrust(throttle, afterburner, M_0, T_0, P_0, rho); //doesn't work
//Calculate Isp
Isp = JetEngine::GetJetEngineIsp(throttle, thrust); //doesn't work
#Isp = GetJetEngineIsp(throttle, thrust); //doesn't work
//Update Isp and thrust of user-defined main engine
SetThrusterIsp(th_main, Isp);
SetThrusterGroupLevel(thg_main, abs(thrust)/(max_thrust*1000));
//----END JET ENGINE IMPLEMENTATION
...
}
I'm really pushing my C++ capabilities here so I'm not quite sure what the problem is, or what's missing. Can anyone help me make sense of this? If I can get this to work this may be very close to ability to release it as an addon.
Last edited: