我正在尝试使用 .off 文件运行 libqglviewer 多选示例,但它显示了以下问题:无法绘制,因为未定义CGAL_USE_BASIC_VIEWER。
所以我补充说 QMAKE_CXXFLAGS +=-DCGAL_USE_BASIC_VIEWER 到 .pro 文件它解决了现有问题,但显示了很多与 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 文件:
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
有什么帮助吗?请
您没有使用正确的 QGLVIewer。CGAL_USE_BASIC_VIEWER仅在libQGLViewer的CGAL实现中是必需的,它只应该在CGAL图形中使用。检查路径并避免包含 CGAL 的路径。