CGAL绘制函数在Visual Studio中给出“未定义CGAL_USE_BASIC_VIEWER"错误 [英] CGAL draw function is giving 'CGAL_USE_BASIC_VIEWER is not defined' error in Visual Studio

查看:225
本文介绍了CGAL绘制函数在Visual Studio中给出“未定义CGAL_USE_BASIC_VIEWER"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从点云生成网格和3D对象.我搜索了很多库,因此决定使用CGAL.我遵循了 youtube教程.由于我想查看对象,因此我需要使用Qt5库(如所述

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
  • 提升1_71_0

问题是,当我调用 CGAL :: draw()函数时,它给了我这个错误

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

由于未定义CGAL_USE_BASIC_VIEWER,​​因此无法绘制.

Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined.

搜索后,通常可以找到

QMAKE_CXXFLAGS + =-DCGAL_USE_BASIC_VIEWER
LIBS + =-DCGAL_USE_BASIC_VIEWER

QMAKE_CXXFLAGS +=-DCGAL_USE_BASIC_VIEWER
LIBS+=-DCGAL_USE_BASIC_VIEWER

.pro 文件解决方案(我没有.pro文件)和

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

我无法应付他们.有Windows Visual Studio解决方案吗?
我们如何定义 CGAL_USE_BASIC_VIEWER ?
我需要导入一些Qt5库吗?

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?

提前谢谢!

更新
我的问题是我在观看视频.在视频中,他没有使用cmake构建源代码,而是手动添加了库等.

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.

当我使用cmake构建源代码时,它可以工作.此处.

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

推荐答案

使用cmake,您需要执行以下操作才能使用CGAL基本查看器:

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

1)在QT5中使用cgal

1) use cgal with QT5

find_package(CGAL组件Qt5)

find_package(CGAL COMPONENTS Qt5)

2)定义CGAL_USE_BASIC_VIEWER

2) define CGAL_USE_BASIC_VIEWER

add_definitions(-DCGAL_USE_BASIC_VIEWER)

add_definitions(-DCGAL_USE_BASIC_VIEWER)

3)将程序与CGAL_Qt5链接

3) link your program with CGAL_Qt5

target_link_libraries(myexe PUBLIC CGAL :: CGAL_Qt5)

target_link_libraries(myexe PUBLIC CGAL::CGAL_Qt5)

看看使用基本查看器的CGAL中的不同示例,例如 draw_triangulation_3.cpp 及其

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

这篇关于CGAL绘制函数在Visual Studio中给出“未定义CGAL_USE_BASIC_VIEWER"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆