mbasaglia / Qt-Color-Widgets

Color wheel widget and dialog for Qt
147 stars 54 forks source link

compile error (Linux mint) #18

Closed nikolakn closed 8 years ago

nikolakn commented 8 years ago

[ 49%] Building CXX object submodules/ColorWidgets/CMakeFiles/ColorWidgets-qt5.dir/include/moc_color_dialog.cpp.o /PixelCayman/build/submodules/ColorWidgets/include/moc_color_dialog.cpp:199:10: error: ‘ColorWheel’ has not been declared &ColorWheel::staticMetaObject, ^ make[2]: *** [submodules/ColorWidgets/CMakeFiles/ColorWidgets-qt5.dir/include/moc_color_dialog.cpp.o] Error 1 make[1]: *** [submodules/ColorWidgets/CMakeFiles/ColorWidgets-qt5.dir/all] Error 2 make: *** [all] Error 2

mbasaglia commented 8 years ago

What compiler version?

nikolakn commented 8 years ago

gcc 4.8.5 QMake version 3.0 Using Qt version 5.2.1

mbasaglia commented 8 years ago

I can compile Color Widgets just fine with gcc 4.8.5 both on its own and from PixelCayman...

You can try to remove the build directory and re-compile from scratch.

nikolakn commented 8 years ago

I try that, maybe it is because my linux is x86 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:37:25 UTC 2015 i686 i686 i686 GNU/Linux

mbasaglia commented 8 years ago

maybe your version of Qt meta object compiler is not handling namespaces or includes correctly

nikolakn commented 8 years ago

i found error but not make it to work, my qt5 is installed in wrong path because cpu type cmake serach for it in /usr/lib/x86_64-linux-gnu/qt5/bin/ on my system it is in /usr/lib/i386-linux-gnu/qt5/bin I will try to resolve it with sim links

hyOzd commented 7 years ago

maybe your version of Qt meta object compiler is not handling namespaces or includes correctly

I think this is indeed a problem with Qt 5.2 which comes with ubuntu 14.04 (and based distros). Problem doesn't occur with Qt 5.4 and later.

hyOzd commented 7 years ago

For those who cannot update their toolchain I've created a distasteful patch that seems to work:

diff --git a/include/color_dialog.hpp b/include/color_dialog.hpp
index 5c7653d..895215c 100644
--- a/include/color_dialog.hpp
+++ b/include/color_dialog.hpp
@@ -30,6 +30,8 @@

 class QAbstractButton;

+using namespace color_widgets;
+
 namespace color_widgets {

 class QCP_EXPORT ColorDialog : public QDialog
diff --git a/include/color_list_widget.hpp b/include/color_list_widget.hpp
index 282bea5..7d8e0c5 100644
--- a/include/color_list_widget.hpp
+++ b/include/color_list_widget.hpp
@@ -25,6 +25,8 @@
 #include "abstract_widget_list.hpp"
 #include "color_wheel.hpp"

+using namespace color_widgets;
+
 namespace color_widgets {

 class QCP_EXPORT ColorListWidget : public AbstractWidgetList
diff --git a/include/color_selector.hpp b/include/color_selector.hpp
index db817d5..48b374d 100644
--- a/include/color_selector.hpp
+++ b/include/color_selector.hpp
@@ -25,6 +25,8 @@
 #include "color_preview.hpp"
 #include "color_wheel.hpp"

+using namespace color_widgets;
+
 namespace color_widgets {

 /**