我试着用Visual Studio编译CGAL,不幸的是我每次都得到一个错误的信息。CGAL::draw().在下面的链接中,我找到了一个解决方案,但我不知道我需要在Visual Studio中输入什么来链接我的QT-Basic-Viewer和target_link,以便用CGAL和Visual Studio进行编译,如果有人能帮助我解决这个问题,我会非常感激。
CGAL绘制函数在Visual Studio中出现'CGAL_USE_BASIC_VIEWER is not defined'的错误。
这是我的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中的draw函数会出现错误?
我现在在Cmake中对Draw函数打了个勾,但不幸的是,我在Visual Studio中仍然得到同样的错误。我到底该怎么做才能解决这些错误?
不幸的是,我现在有了一个新的问题,Visual Studio找不到数据,它说系统找不到数据(见下文)。我可以做什么来纠正这个错误,我必须做哪些设置?
你需要安装 cgal[qt]
而不仅仅是vcpkg中的 cgal
否则,你会丢失一些图形示例的依赖性。请阅读 本页 关于如何使用vcpkg的CGAL的所有细节。