Building an example with sitl

I try to build one of the example sketches, namely AP_GPS/examples/GPS_AUTO_test. I go to that directiory and give the command “make sitl”. A lot of files are compiled with no problems, but at the end the linking fails with this error message:

/tmp/ In function `HALSITL::SITL_State::_update_flow()':
/home/arndt/moped/rover/ardupilot/libraries/AP_HAL_SITL/sitl_optical_flow.cpp:113: undefined reference to `OpticalFlow::setHIL(OpticalFlow::OpticalFlow_state const&)'

How do I make the build succeed? And how come this doesn’t happen with the main targets, for example APMrover2?

(I tested with commenting out the call in question, and then the linking succeeds, but the call is vital for the function, because then it crashes at an early stage when I run it.)

I don’t think I will use optical flow as such at all, because I don’t have such a sensor, so disabling this code somehow would also be a solution for me.

I think that was a transient issue in the build. In your ardupilot folder run
git pull --rebase
git submodule update
then change directory to APMrover2 and run
make sitl
and let us know how you go.
Thanks, Grant.