Skip to content

Cannot be built because of bit_variable not defined, reinterpret_cast and no template called "optional" #1

Description

@KhazAkar

Hi!
I've tried building your program on openSUSE Tumbleweed using clang++, but it cannot.
Here is the log:

[  4%] Building CXX object CMakeFiles/canviewer.dir/canviewer.cpp.o
In file included from /home/khazakar/downloadedwithgit/canviewer/canviewer.cpp:14:
In file included from /home/khazakar/downloadedwithgit/canviewer/gtkmm/MainWindow.hpp:33:
In file included from /home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/message.h:7:
In file included from /home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/variable.h:8:
In file included from /home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/bit_variable.h:4:
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/endian.h:10:20: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
    constexpr bool is_little_endian()
                   ^
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/endian.h:13:24: note: reinterpret_cast is not allowed in a constant expression
        uint8_t *ptr = reinterpret_cast<uint8_t*>(&value);
                       ^
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/endian.h:20:20: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
    constexpr bool is_big_endian()
                   ^
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/endian.h:23:24: note: reinterpret_cast is not allowed in a constant expression
        uint8_t *ptr = reinterpret_cast<uint8_t*>(&value);
                       ^
In file included from /home/khazakar/downloadedwithgit/canviewer/canviewer.cpp:14:
In file included from /home/khazakar/downloadedwithgit/canviewer/gtkmm/MainWindow.hpp:33:
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/message.h:17:39: error: no template named 'optional' in namespace 'std'
            using opt_variable = std::optional<variable>;
                                 ~~~~~^
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/message.h:50:13: error: unknown type name 'opt_variable'; did you mean 'bit_variable'?
            opt_variable operator[](std::string) const;
            ^~~~~~~~~~~~
            bit_variable
/home/khazakar/downloadedwithgit/canviewer/gtkmm/../can/bit_variable.h:9:11: note: 'bit_variable' declared here
    class bit_variable
          ^
4 errors generated.
make[2]: *** [CMakeFiles/canviewer.dir/build.make:76: CMakeFiles/canviewer.dir/canviewer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/canviewer.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions