error: no '' member function declared in class 'SonarSRF08'
Please note that I did not try to run your code on my Mega because I don't have SRFs
However, here is what I tried to recreate your error:

I went to the arduino homepage and downloaded the 1.0.5 version.

I downloaded the zipped library from this page SRF08 Ultra Sonic Range Finder

I imported the library into the arduino IDE. For this, I had to unpack the .zip and rename the folder of the library because arduino complained about non-ascii characters. I just called the enclosing folder &quot;arduinoSRFmaster&quot; without dashes. After that it let me import the library the usual way:


After that I copied your code into a new sketch and hit Ctrl + R to compile and verify. It compiled just fine:



(Picture updated for compiling against MEGA)
Please provide more information, like yor OS, Arduino Version, where you got the SRF Library from etc. if that didn't help.