psmokotnin / osm

Open sound meter. FFT based application for tuning sound systems.
GNU General Public License v3.0
222 stars 35 forks source link

build fails on openSUSE Tumbleweed: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’ #49

Closed nettings closed 1 year ago

nettings commented 2 years ago

Pretty sure this is a distro issue rather than a bug in osm, but I'm reporting it anyways in case someone hits the same problem. It seems to be a common issue that some versions of the C++ std library are missing some often-used math functions, but I have been unable to find a quick fix. Any hints?

src/union.cpp:313:30: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  313 |         module = 20.f * std::log10f((primary)->module(i));
      |                              ^~~~~~
      |                              log1pf
src/union.cpp:324:43: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  324 |                     module += 20.f * std::log10f((*it)->module(i));
      |                                           ^~~~~~
      |                                           log1pf
src/union.cpp:329:43: error: ‘log10f’ is not a member of ‘std’; did you mean ‘log1pf’?
  329 |                     module -= 20.f * std::log10f((*it)->module(i));
      |                                           ^~~~~~
      |                                           log1pf
psmokotnin commented 2 years ago

Thank you! Recently, I reworked union and didn't yet check it for Linux. A quick fix should be to add: #include <cmath>; to the file union.cpp

nettings commented 2 years ago

Tried that, and also tried replacing all other occurrences of "math.h" with , but no luck... That's why I guess it's maybe a distritbution thing... sometimes it happens that default includes in <...> are not found, and if I use the full path, it works. Dunno what's going on there... but then, C++ is really not my strong point.

nettings commented 2 years ago

Replacing std::log10f with the generic std::log10 fixes it, and I now have it running. I don't know if that is a reasonable fix, but looking forward to playing with osm. :o)

psmokotnin commented 1 year ago

fixed