我是使用CGAL庫的初學者,我正在使用Fedora OS的qt創建器, 我構建並配置了CGAL包,然後創建了控制檯應用程序並嘗試此示例(已安裝與CGAL包):使用qt創建器錯誤運行cgal示例
// Author(s) : Camille Wormser, Pierre Alliez
#include <iostream>
#include <list>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Ray_3 Ray;
typedef K::Line_3 Line;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef std::list<Triangle>::iterator Iterator;
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
int main()
{
Point a(1.0, 0.0, 0.0);
Point b(0.0, 1.0, 0.0);
Point c(0.0, 0.0, 1.0);
Point d(0.0, 0.0, 0.0);
std::list<Triangle> triangles;
triangles.push_back(Triangle(a,b,c));
triangles.push_back(Triangle(a,b,d));
triangles.push_back(Triangle(a,d,c));
// constructs AABB tree
Tree tree(triangles.begin(),triangles.end());
// counts #intersections
Ray ray_query(a,b);
std::cout << tree.number_of_intersected_primitives(ray_query)
<< " intersections(s) with ray query" << std::endl;
// compute closest point and squared distance
Point point_query(2.0, 2.0, 2.0);
Point closest_point = tree.closest_point(point_query);
std::cerr << "closest point is: " << closest_point << std::endl;
FT sqd = tree.squared_distance(point_query);
std::cout << "squared distance: " << sqd << std::endl;
return EXIT_SUCCESS;
}
,然後我加入了頭文件到項目: 「Simple_cartesian.h」 - 「AABB_tree.h」 - 「AABB_traits.h」 - 「AABB_triangle_primitive.h」
但是在運行項目時我遇到了這些呃RORS: :-1:錯誤:main.o:未定義的引用符號 '_ZN5boost6system15system_categoryEv'
:-1:錯誤:注意: '_ZN5boost6system15system_categoryEv' 在DSO /lib64/libboost_system.so.1.54.0定義因此嘗試將其添加到鏈接器命令行
/lib64/libboost_system.so.1.54.0:-1:錯誤:無法讀取符號:無效操作
:-1:錯誤:collect2:錯誤: ld返回1退出狀態
任何他請問?
非常感謝, 解決了我的問題 –