【发布时间】:2020-05-23 16:19:05
【问题描述】:
我曾尝试使用 Visual Studio 编译 CGAL,但不幸的是,我每次都会收到错误 CGAL::draw()。 通过下面的链接,我找到了一个解决方案,但我不知道我需要在 Visual Studio 中输入的位置和内容来链接我的 QT-Basic-Viewer 和 target_link 以使用 CGAL 和 Visual Studio 进行编译。 如果有人能帮助我解决这个问题,我将不胜感激。
CGAL draw function is giving 'CGAL_USE_BASIC_VIEWER is not defined' error in Visual Studio
这是我的 Cmake 文本文件:
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.17.2)
project( Surface_mesh_Examples )
if(POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
if(NOT POLICY CMP0070)
cmake_policy(SET CMP0053 OLD)
else()
cmake_policy(SET CMP0053 NEW)
endif()
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL COMPONENTS Qt5)
if(CGAL_Qt5_FOUND)
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
endif()
if ( CGAL_FOUND )
create_single_source_cgal_program( "sm_derivation.cpp" )
create_single_source_cgal_program( "sm_join.cpp" )
create_single_source_cgal_program( "sm_aabbtree.cpp" )
create_single_source_cgal_program( "sm_bgl.cpp" )
create_single_source_cgal_program( "sm_circulators.cpp" )
create_single_source_cgal_program( "sm_do_intersect.cpp" )
create_single_source_cgal_program( "sm_iterators.cpp" )
create_single_source_cgal_program( "sm_kruskal.cpp" )
create_single_source_cgal_program( "sm_memory.cpp" )
create_single_source_cgal_program( "sm_properties.cpp" )
create_single_source_cgal_program("draw_surface_mesh.cpp")
create_single_source_cgal_program("sm_draw_small_faces.cpp")
create_single_source_cgal_program("check_orientation.cpp")
if(CGAL_Qt5_FOUND )
target_link_libraries(draw_surface_mesh PUBLIC CGAL::CGAL_Qt5)
target_link_libraries(sm_draw_small_faces PUBLIC CGAL::CGAL_Qt5)
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()
还有 CMake 中的已安装列表,那么为什么我在 Visual Studio 中的绘图功能上会出错?
我现在在 Cmake 中对 Draw 函数有一个复选标记,但不幸的是,我在 Visual Studio 中仍然遇到同样的错误。我究竟能做些什么来修复这些错误?
不幸的是,我现在遇到了一个新问题,Visual Studio 找不到数据,它说系统找不到数据(见下文)。我能做些什么来纠正错误,我必须进行哪些设置?
【问题讨论】:
-
请显示完整的错误消息和带有您的代码的minimal reproducible example
-
感谢您的快速回复。不幸的是,我只收到此错误,在 Visual Studio 中绘制带有红色下划线
-
@AlanBirtles 我已经添加了整个 Cmake 文本和安装指南,如果这可以帮助您理解确切的问题。非常感谢您的帮助!
-
可能没有配置CGAL_Qt5,可能是因为它遗漏了一些依赖。在 CGAL root 上运行 cmake,并读取所有日志消息;它会为您提供缺少的依赖项列表。