Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error: ‘bit_cast’ is not a member of ‘std’; did you mean ‘bad_cast’? #42

Open
zhangyingjie7 opened this issue Sep 1, 2023 · 1 comment

Comments

@zhangyingjie7
Copy link

Hi all,
I follow the tutorial to compile MOTION, but when I run "make", error occurs

MOTION/src/motioncore/utility/helpers.h:516:15: error: ‘bit_cast’ is not a member of ‘std’; did you mean ‘bad_cast’?
  516 |   return std::bit_cast<U>(input);
      |               ^~~~~~~~
      |               bad_cast
MOTION/src/motioncore/utility/helpers.h:516:25: error: expected primary-expression before ‘>’ token
  516 |   return std::bit_cast<U>(input);
      |                         ^

Could you please help me with this?

Packages version in my computer

gcc version 10.5.0 (Ubuntu 10.5.0-1ubuntu1~20.04)
boost version 1.76
openssl version 1.1.1f
@robinhundt
Copy link
Contributor

Hi, as noted in the readme, you need a compiler with support for C++20. It seems the given recommendation of >=10 is to low, as version 10 does not support all parts of C++20 that are used by MOTION. Notably, std::bit_cast is implemented in libstdc++ version 11.1 (see https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html).

I recommend you upgrade your compiler to the newest version. GCC13 came with some breaking changes as well, but these should be fixed on the main branch by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants