问题
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