olive-editor / olive

Free open-source non-linear video editor
https://olivevideoeditor.org/
GNU General Public License v3.0
8.16k stars 554 forks source link

[BUILD] error: no member named 'floor' in namespace 'std' #2202

Closed yurivict closed 1 year ago

yurivict commented 1 year ago

Commit Hash 8ca1672

Platform FreeBSD 13.1

Summary

/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:55:36: error: no member named 'floor' in namespace 'std'
      int64_t total_seconds = std::floor(time_dbl);
                              ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:60:31: error: no member named 'llround' in namespace 'std'
      int64_t fraction = std::llround((time_dbl - static_cast<double>(total_seconds)) * 1000);
                         ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:71:37: error: no member named 'llround' in namespace 'std'
      int rounded_frame_rate = std::llround(frame_rate);
                               ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:87:20: error: no member named 'llround' in namespace 'std'
        f %= (std::llround(frame_rate*3600)*24);
              ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:90:43: error: no member named 'llround' in namespace 'std'
        int64_t framesPer10Minutes = std::llround(frame_rate * 600);
                                     ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:95:35: error: no member named 'llround' in namespace 'std'
        int64_t dropFrames = std::llround(frame_rate * (2.0/30.0));
                             ~~~~~^
/wrkdirs/usr/ports/multimedia/olive/work/olive-8ca1672/ext/core/src/util/timecodefunctions.cpp:100:55: error: no member named 'llround' in namespace 'std'
          f += dropFrames * ((m - dropFrames) / (std::llround(frame_rate)*60 - dropFrames));
                                                 ~~~~~^

Did you forget to include <cmath>?

yurivict commented 1 year ago

Why?

itsmattkc commented 1 year ago

I apologize for the inconvenience, but we no longer accept issues related to self-compiling. See the recently amended FAQ at #1175 for more information. Feel free to open a pull request if minor changes are necessary to build on certain environments, we will probably accept it.

yurivict commented 1 year ago

Hi @itsmattkc ,

I understand your motivation behind the FAQ change, but the issues that I've reported are valid C++ issues in the code. For example, this issue was reported because timecodefunctions.cpp lacks #include <cmath>.

Yuri

itsmattkc commented 1 year ago

While it's probably true we should have that include explicitly stated, it is not an issue on any of our existing compiles (https://github.com/olive-editor/olive/actions), indicating a certain degree of platform specificity that we can't test for.

What concerns me is if there are other includes necessary for building on your platform too, we'll have to go back and forth on this adding includes one at a time, which is specifically the sort of thing that rule was introduced to prevent. That's why I encourage you to make a PR for any changes necessary to get it compiling on your platform.

yurivict commented 1 year ago

[...] there are other includes necessary for building on your platform too [...]

Set of includes necessary for build does not depend on platform. It are defined by the STL functions that you use. But in different STL implementations these includes are already included from other STL includes, so you are lucky that this code works. And in other STL implementation this code would break.

Correct C++ code does not depend on STL implementation and always works.