I’m trying to use float smoothed_airspeed defined in plane.h within the tiltrotor.cpp function Quadplane::tiltrotor_slew
There is a #include “plane.h” at the top of the file but compiling it comes back with 'smoothed_airspeed" was not declared in this scope.
What am I missing here? It’s probably dumb but it’s preventing me from perfecting my transition
TIA
Hi Andrew,
Definitely not an expert, but all you’ll have to do is use plane.smoothed_airspeed
instead of just smoothed_airspeed
in this case 
Actually, I learnt a few new things when I was going deeper into this, since I’m not very familiar with C++. I was wondering why the Quadplane
class had access to the plane
object in the first place.
It declares Plane as a friend class, so it has access to everything inside it:
public:
friend class Plane`
But the real reason it sees a plane
object at all is because in Plane.h
, this is declared
extern Plane plane;
And this is (I think) filled up in Plane.cpp
after the constructor. So the reason you needed to go through plane
to get smoothed_airspeed
is because smoothed_airspeed
belongs to the Plane
class, and what I’ve said here is why you can access plane
in the first place.
This is probably pretty trivial, but just an interesting learning point for me 
Thanks @frizensami !
I don’t fully understand how it all hangs together yet but your solution fixed things up!
Remember too, in the valley of the blind, the one-eyed man is king! 
1 Like