我正在处理一些计算几何问题,并试图使用CGAL库来完成一些繁重的工作。我使用的是Visual Studio 2015 Community Edition和CGAL 4.9。但是,当我尝试构建和运行我的项目时,会发生一些奇怪的事情:构建过程在生成代码"之后卡住了,所以输出看起来像:
1> Generating code
1> 63 of 8736 functions ( 0.7%) were compiled, the rest were copied from previous compilation.
1> 0 functions were new in current compilation
1> 43 functions had inline decision re-evaluated but remain unchanged
1> Finished generating code
VS显示仍然存在某些事情(它是响应式的,因此VS本身并不挂起),如果我尝试关闭VS,则会出现The build must be stopped before the solution can be closed.
的错误。我甚至试着等了几个小时看看会发生什么,而且构建还没有结束。所以我刚刚结束了这个过程" MSBuild.exe"使用任务管理器(导致VS提供退出进程的错误)
1>MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.
1>A task was canceled.
1>A task was canceled.
(我无法找到错误消息中提到的MSBuild_*.failure.txt
文件。之后,我关闭了VS,重新打开了项目,并尝试重新构建项目。这一次,它很成功,而且非常快,几秒钟左右。
问题偶尔发生(经过几次代码编辑,重建几次),并且总是结束构建过程并重新启动VS解决了这个问题。我没有在我的任何其他项目中遇到过这个问题,这就是为什么我在这里有CGAL标签,但它可能与CGAL无关。
我想知道是否有其他人遇到过此问题,以及是否有解决方法。我不认为这很重要,但这是一个有这个问题的简单程序:
#define CGAL_EIGEN3_ENABLED
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
#include <CGAL/extract_mean_curvature_flow_skeleton.h>
#include <CGAL/boost/graph/split_graph_into_polylines.h>
#include <fstream>
#include <boost/foreach.hpp>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
typedef CGAL::Mean_curvature_flow_skeletonization<Polyhedron> Skeletonization;
typedef Skeletonization::Skeleton Skeleton;
typedef Skeleton::vertex_descriptor Skeleton_vertex;
typedef Skeleton::edge_descriptor Skeleton_edge;
int main(int argc, char* argv[])
{
std::ifstream input((argc>1) ? argv[1] : "data/armadillo.off");
Polyhedron tmesh;
input >> tmesh;
Skeleton skeleton;
CGAL::extract_mean_curvature_flow_skeleton(tmesh, skeleton);
std::ofstream output("skeleton.ply");
output << "ply\n";
output << "format ascii 1.0\n";
output << "element vertex " << boost::num_vertices(skeleton) << "\n";
output << "property float x\n";
output << "property float y\n";
output << "property float z\n";
output << "end_header\n";
BOOST_FOREACH(Skeleton_vertex v, vertices(skeleton))
output << skeleton[v].point << "\n";
return 0;
}