mortbopet / VSRTL

Visual Simulation of Register Transfer Logic
MIT License
87 stars 17 forks source link

Build error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::WIRE_DEFAULT_COLOR’ is not literal #54

Closed nandlab closed 2 years ago

nandlab commented 2 years ago

Hello, I get the following build error when I try to build VSRTL. I have Linux Mint on my machine:

Scanning dependencies of target vsrtl_gfx_lib
[ 18%] Building CXX object graphics/CMakeFiles/vsrtl_gfx_lib.dir/vsrtl_gfx_lib_autogen/mocs_compilation.cpp.o
In file included from /home/dan/git/VSRTL/graphics/vsrtl_componentbutton.h:8,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/EWIEGA46WW/moc_vsrtl_componentbutton.cpp:9,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/mocs_compilation.cpp:2:
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:24:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::WIRE_DEFAULT_COLOR’ is not literal
   24 | constexpr QColor WIRE_DEFAULT_COLOR = {0x63, 0x63, 0x63};
      |                  ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qpixmap.h:45,
                 from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qgraphicsitem.h:49,
                 from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QGraphicsObject:1,
                 from /home/dan/git/VSRTL/graphics/vsrtl_componentbutton.h:4,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/EWIEGA46WW/moc_vsrtl_componentbutton.cpp:9,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/mocs_compilation.cpp:2:
/usr/include/x86_64-linux-gnu/qt5/QtGui/qcolor.h:64:20: note: ‘QColor’ is not literal because:
   64 | class Q_GUI_EXPORT QColor
      |                    ^~~~~~
/usr/include/x86_64-linux-gnu/qt5/QtGui/qcolor.h:64:20: note:   ‘QColor’ is not an aggregate, does not have a trivial default constructor, and has no ‘constexpr’ constructor that is not a copy or move constructor
In file included from /home/dan/git/VSRTL/graphics/vsrtl_componentbutton.h:8,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/EWIEGA46WW/moc_vsrtl_componentbutton.cpp:9,
                 from /home/dan/git/VSRTL/graphics/vsrtl_gfx_lib_autogen/mocs_compilation.cpp:2:
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:25:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::WIRE_SELECTED_COLOR’ is not literal
   25 | constexpr QColor WIRE_SELECTED_COLOR = {0xFE, 0xF1, 0x60};
      |                  ^~~~~~~~~~~~~~~~~~~
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:26:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::WIRE_BOOLHIGH_COLOR’ is not literal
   26 | constexpr QColor WIRE_BOOLHIGH_COLOR = {0x6E, 0xEB, 0x83};
      |                  ^~~~~~~~~~~~~~~~~~~
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:27:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::WIRE_HIGH_COLOR’ is not literal
   27 | constexpr QColor WIRE_HIGH_COLOR = {0xFF, 0xD5, 0x2E};
      |                  ^~~~~~~~~~~~~~~
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:28:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::BACKGROUND_COLOR’ is not literal
   28 | constexpr QColor BACKGROUND_COLOR = {0x22, 0x22, 0x22};
      |                  ^~~~~~~~~~~~~~~~
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:29:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::BUTTON_COLLAPSE_COLOR’ is not literal
   29 | constexpr QColor BUTTON_COLLAPSE_COLOR = {0x6b, 0xc8, 0xff};
      |                  ^~~~~~~~~~~~~~~~~~~~~
/home/dan/git/VSRTL/graphics/vsrtl_graphics_defines.h:30:18: error: the type ‘const QColor’ of ‘constexpr’ variable ‘vsrtl::BUTTON_EXPAND_COLOR’ is not literal
   30 | constexpr QColor BUTTON_EXPAND_COLOR = {0x26, 0xa6, 0x5b};
      |                  ^~~~~~~~~~~~~~~~~~~
make[2]: *** [graphics/CMakeFiles/vsrtl_gfx_lib.dir/build.make:103: graphics/CMakeFiles/vsrtl_gfx_lib.dir/vsrtl_gfx_lib_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:418: graphics/CMakeFiles/vsrtl_gfx_lib.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Can you please fix it?

mortbopet commented 2 years ago

While CI is currently down in this repo, Ripes is currently building successfully. constexpr QColor is - as far as i remember - only available from Qt 5.14 and onwards, so make sure you have an up to date Qt version. If this is the case, then please let me know and i'll take another look at this.

nandlab commented 2 years ago

Thanks for your quick reply. I was indeed trying to compile Ripes from source. I have Qt 5.12.8 installed and there is no newer version available in the apt repo right now, so it is outdated. Sorry, did not check that before. But the Ripes AppImage works!