CGAL draw function is giving 'CGAL_USE_BASIC_VIEWER is not defined' error in Visual Studio

做~自己de王妃 提交于 2021-01-28 08:40:28

问题


I am trying to generate mesh and 3D object from point cloud. I have searched lots of libraries and I decided to use CGAL. I followed this youtube tutorial. Due to the fact that I want to see the objects, I need to use Qt5 library (as mentioned here) and I downloaded it. And it worked as in tutorial.

Libraries and applications I've used

  • CMake 3.15.3
  • CGAL-4.13.1
  • Qt 5.13.0
  • Boost 1_71_0

The problem is that when I call the CGAL::draw() function it gives me this error

Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined.

When I have searched for it, I have generally found

QMAKE_CXXFLAGS +=-DCGAL_USE_BASIC_VIEWER
LIBS+=-DCGAL_USE_BASIC_VIEWER

.pro file solution (I don't have .pro file) and this

I couldn't handle with them. Is there a windows visual studio solution?
How do we define CGAL_USE_BASIC_VIEWER?
Do I need to import some Qt5 libs?

Thanks in advance!

UPDATE
My problem was that I was following the video. And in the video, the guy didn't build the source with cmake, he added libraries etc with manually.

When I build the source code with cmake, it works. There is a very simple tutorial Here.


回答1:


With cmake, you need to do the following to use CGAL basic viewers:

1) use cgal with QT5

find_package(CGAL COMPONENTS Qt5)

2) define CGAL_USE_BASIC_VIEWER

add_definitions(-DCGAL_USE_BASIC_VIEWER)

3) link your program with CGAL_Qt5

target_link_libraries(myexe PUBLIC CGAL::CGAL_Qt5)

Have a look to the different examples in CGAL that uses basic viewer, for example draw_triangulation_3.cpp and its CMakeLists.txt.



来源:https://stackoverflow.com/questions/57892242/cgal-draw-function-is-giving-cgal-use-basic-viewer-is-not-defined-error-in-vis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!