Search code examples
arduinocounterfrequency

error using frequncycounter library in arduino mega


enter image description here

dear i wrote this code to calculate wind speed from anemometer below the error message

windspeedcode2:15: error: 'FreqCount' is not a class, namespace, or enumeration

FreqCount::f_comp= 8; // Set compensation to 12

^

windspeedcode2:16: error: 'FreqCount' is not a class, namespace, or enumeration

FreqCount::start(100); // Start counting with gatetime of 100ms

^

windspeedcode2:17: error: 'FreqCounter' has not been declared

while (FreqCounter::f_ready == 0) // wait until counter ready

     ^

windspeedcode2:19: error: 'FreqCount' is not a class, namespace, or enumeration

freq=FreqCount::f_freq;//read frequency value

   ^

exit status 1 'FreqCount' is not a class, namespace, or enumeration

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.


Solution

  • :: is the scope resolution operator for defining the same function outside the class

    . is the dot operator used to call a member function (or member variable) on a object.

    An example would be (assuming a instance named FreqCount exist in you library header): FreqCount.f_comp= 8;

    Only if f_comp is a static class member variable can it be accessed is you called it: FreqCount::f_comp= 8; But that is unlikely for a library.

    So what is in your header and where does the library come from?