栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

环境配置 | win10下配置cgal+vs2017

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

环境配置 | win10下配置cgal+vs2017

目录

1.CGAL和相关库的下载

2.安装boost并配置环境变量

3.给vs2017配置CGAL库

3.1 添加包含目录

3.2 添加库目录

3.3 添加依赖项

4.运行测试程序

参考文章

1.CGAL和相关库的下载

进入https://github.com/CGAL/cgal/releases

下载这两个压缩包

分别解压缩以后,进行如下移动

选择直接替换

2.安装boost并配置环境变量

进入https://sourceforge.net/projects/boost/files/boost-binaries/1.71.0/boost_1_71_0-msvc-14.1-64.exe/download

下载二进制文件并运行

记住安装路径C:Softwareboost_1_71_0

接下来需要配置2个普通环境变量,并将一个路径添加到Path

第1个普通环境变量

 BOOST_LIBRARYDIR   C:Softwareboost_1_71_0lib64-msvc-14.1

操作如图

 第2个普通环境变量

BOOST_INCLUDEDIR C:Softwareboost_1_71_0

接着将上述第1个路径添加到Path变量后(此处过程可以自己检索,不再赘述)

3.给vs2017配置CGAL库

共计3步:添加包含目录、添加库目录、添加依赖项。

在上述三步之前先新建一个项目,进入属性管理器

选择“添加新项目属性表”(此后可以复用这个属性表)

 修改属性表名称为cgal_5.4

双击刚刚建好的属性表

3.1 添加包含目录

依次加入以下3个路径

3.2 添加库目录

 依次加入以下2个路径

3.3 添加依赖项

主要指这两个lib文件

找到

复制2个.lib文件

 

 

4.运行测试程序
#include 
#include 
#include 
#include 
#include 
#include 
typedef CGAL::Simple_cartesian K;
typedef K::Point_2 Point_d;
typedef CGAL::Search_traits_2 TreeTraits;
typedef CGAL::Orthogonal_k_neighbor_search Neighbor_search;
typedef Neighbor_search::Tree Tree;
int main()
{
	const unsigned int N = 1;
	std::list points;
	points.push_back(Point_d(0, 0));
	Tree tree(points.begin(), points.end());
	// Initialize the search structure, and search all N points
	Point_d query(0, 0);
	Neighbor_search search(tree, query, N);
	// report the N nearest neighbors and their distance
   // This should sort all N points by increasing distance from origin
	for (Neighbor_search::iterator it = search.begin(); it != search.end(); ++it)
		std::cout << it->first << " " << std::sqrt(it->second) << std::endl;
	return 0;
}

 若上述步骤都正确,则不会报错;若报错,可以回过头检查一下。

 还有就是运行时注意这两个地方保持一致

参考文章

https://doc.cgal.org/latest/Manual/windows.html#title8

https://blog.csdn.net/weixin_46098577/article/details/122609078

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/955407.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号