0

I'm trying to run libqglviewer multiselection example with .off file , but it show's the following problem : Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined.

So I added QMAKE_CXXFLAGS +=-DCGAL_USE_BASIC_VIEWER to .pro file it solves the existing problem but shows a lot of errors related to Basic_viewer_qt.h

/usr/include/CGAL/Qt/Basic_viewer_qt.h:146:1: error: expected class-name before ‘{’ token
 {
 ^
/usr/include/CGAL/Qt/Basic_viewer_qt.h:552:29: error: ‘CGAL::QGLViewer’ has not been declared
   void attrib_buffers(CGAL::QGLViewer* viewer)
                             ^~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In constructor ‘CGAL::Basic_viewer_qt::Basic_viewer_qt(QWidget*, const char*, bool, bool, bool, bool, bool)’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:160:20: error: expected class-name before ‘(’ token
     CGAL::QGLViewer(parent),
                    ^
/usr/include/CGAL/Qt/Basic_viewer_qt.h:160:20: error: expected ‘{’ before ‘(’ token
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In member function ‘void CGAL::Basic_viewer_qt::attrib_buffers(int*)’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:557:13: error: request for member ‘camera’ in ‘* viewer’, which is of non-class type ‘int’
     viewer->camera()->getModelViewProjectionMatrix(mat);
             ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:562:13: error: request for member ‘camera’ in ‘* viewer’, which is of non-class type ‘int’
     viewer->camera()->getModelViewMatrix(mat);
             ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In member function ‘virtual void CGAL::Basic_viewer_qt::draw()’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:624:24: error: no matching function for call to ‘CGAL::Basic_viewer_qt::attrib_buffers(CGAL::Basic_viewer_qt*)’
     attrib_buffers(this);
                        ^
/usr/include/CGAL/Qt/Basic_viewer_qt.h:552:8: note: candidate: ‘void CGAL::Basic_viewer_qt::attrib_buffers(int*)’
   void attrib_buffers(CGAL::QGLViewer* viewer)
        ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:552:8: note:   no known conversion for argument 1 from ‘CGAL::Basic_viewer_qt*’ to ‘int*’
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In member function ‘virtual void CGAL::Basic_viewer_qt::redraw()’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:727:5: error: ‘update’ was not declared in this scope
     update();
     ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:727:5: note: suggested alternative: ‘QDate’
     update();
     ^~~~~~
     QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In member function ‘virtual void CGAL::Basic_viewer_qt::init()’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:733:5: error: ‘restoreStateFromFile’ was not declared in this scope
     restoreStateFromFile();
     ^~~~~~~~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:734:5: error: ‘initializeOpenGLFunctions’ was not declared in this scope
     initializeOpenGLFunctions();
     ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:734:5: note: suggested alternative: ‘QAbstractOpenGLFunctions’
     initializeOpenGLFunctions();
     ^~~~~~~~~~~~~~~~~~~~~~~~~
     QAbstractOpenGLFunctions
/usr/include/CGAL/Qt/Basic_viewer_qt.h:737:28: error: ‘EXIT_VIEWER’ is not a member of ‘qglviewer’
     setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL+::Qt::Key_Q);
                            ^~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:737:5: error: ‘setShortcut’ was not declared in this scope
     setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL+::Qt::Key_Q);
     ^~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:737:5: note: suggested alternative: ‘QShortcut’
     setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL+::Qt::Key_Q);
     ^~~~~~~~~~~
     QShortcut
/usr/include/CGAL/Qt/Basic_viewer_qt.h:740:5: error: ‘setKeyDescription’ was not declared in this scope
     setKeyDescription(::Qt::Key_E, "Toggles edges display");
     ^~~~~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:774:11: error: ‘class CGAL::Basic_viewer_qt’ has no member named ‘camera’
     this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(),
           ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:774:47: error: ‘CGAL::qglviewer’ has not been declared
     this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(),
                                               ^~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:777:47: error: ‘CGAL::qglviewer’ has not been declared
                                         CGAL::qglviewer::Vec(bb.xmax(),
                                               ^~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:781:11: error: ‘class CGAL::Basic_viewer_qt’ has no member named ‘showEntireScene’
     this->showEntireScene();
           ^~~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h: In member function ‘virtual void CGAL::Basic_viewer_qt::keyPressEvent(QKeyEvent*)’:
/usr/include/CGAL/Qt/Basic_viewer_qt.h:800:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Draw edges=%1.").arg(m_draw_edges?"true":"false"));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:801:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:801:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:806:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Draw faces=%1.").arg(m_draw_faces?"true":"false"));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:807:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:807:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:813:9: error: ‘displayMessage’ was not declared in this scope
         displayMessage("Flat shading.");
         ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:815:9: error: ‘displayMessage’ was not declared in this scope
         displayMessage("Gouraud shading.");
         ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:821:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Mono color=%1.").arg(m_use_mono_color?"true":"false"));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:822:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:822:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:827:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Inverse normal=%1.").arg(m_inverse_normal?"true":"false"));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:834:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Draw vertices=%1.").arg(m_draw_vertices?"true":"false"));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:835:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:835:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:840:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Size of edges=%1.").arg(m_size_edges));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:841:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:841:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:846:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Size of edges=%1.").arg(m_size_edges));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:847:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:847:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:852:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Size of points=%1.").arg(m_size_points));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:853:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:853:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:858:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Size of points=%1.").arg(m_size_points));
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:859:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:859:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:869:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:871:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:871:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:881:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:883:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:883:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:889:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:891:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:891:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:897:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:899:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:899:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:905:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:907:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:907:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:913:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:915:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:915:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:921:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:923:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:923:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:929:7: error: ‘displayMessage’ was not declared in this scope
       displayMessage(QString("Light color=(%1 %2 %3).").
       ^~~~~~~~~~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:931:7: error: ‘update’ was not declared in this scope
       update();
       ^~~~~~
/usr/include/CGAL/Qt/Basic_viewer_qt.h:931:7: note: suggested alternative: ‘QDate’
       update();
       ^~~~~~
       QDate
/usr/include/CGAL/Qt/Basic_viewer_qt.h:934:13: error: ‘CGAL::QGLViewer’ has not been declared
       CGAL::QGLViewer::keyPressEvent(e);

.pro file:

QT += xml quick gui opengl
CONFIG += c++11

DEFINES += QT_DEPRECATED_WARNINGS

 QMAKE_CXXFLAGS +=-DCGAL_USE_BASIC_VIEWER

SOURCES += \
        main.cpp \
    multiselect.cpp \
    manipulatedframesetconstraint.cpp \
    object.cpp

RESOURCES +=

HEADERS += \
    multiselect.h \
    manipulatedframesetconstraint.h \
    object.h

unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lQGLViewer-qt5

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64

unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lQt5OpenGL

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64

unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lGLU

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64

unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lCGAL

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64

unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lCGAL_Core

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64


unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lgmp

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64




unix:!macx: LIBS += -L$$PWD/../../../../lib64/ -lCGAL_ImageIO

INCLUDEPATH += $$PWD/../../../../lib64
DEPENDPATH += $$PWD/../../../../lib64



unix:!macx: LIBS += -L$$PWD/../../../../usr/lib64/ -lQGLViewer-qt5

INCLUDEPATH += $$PWD/../../../../usr/lib64
DEPENDPATH += $$PWD/../../../../usr/lib64


unix:!macx: LIBS += -L$$PWD/../../../../usr/lib64/ -lCGAL_Qt5

INCLUDEPATH += $$PWD/../../../../usr/lib64
DEPENDPATH += $$PWD/../../../../usr/lib64

any help? please

user3019180
  • 80
  • 1
  • 7
  • This post may be helpful. https://stackoverflow.com/questions/53150670/impossible-to-draw-because-cgal-use-basic-viewer-is-not-defined – frogatto Jul 22 '19 at 08:23
  • You should create a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). – lrineau Jul 23 '19 at 12:52

1 Answers1

0

You are not using the right QGLVIewer. CGAL_USE_BASIC_VIEWER is only required in the CGAL implementation of libQGLViewer, that is only supposed to be used in CGAL graphical stuff. Check you paths and avoid the ones containing CGAL.

mgimeno
  • 726
  • 1
  • 4
  • 7