C++ 将CGAL与代码::块一起使用

C++ 将CGAL与代码::块一起使用,c++,compiler-errors,cgal,C++,Compiler Errors,Cgal,我试着运行代码,但是我得到了很多未定义的引用错误 这是错误日志: g++ -c /home/cagirici/Test/test.cpp -o /home/cagirici/Test/test.o g++ -o /home/cagirici/Test/test /home/cagirici/Test/test.o /home/cagirici/Test/test.o: In function `main': test.cpp:(.text+0x14): undefined refer

我试着运行代码,但是我得到了很多
未定义的引用
错误

这是错误日志:

g++   -c /home/cagirici/Test/test.cpp -o /home/cagirici/Test/test.o
g++  -o /home/cagirici/Test/test /home/cagirici/Test/test.o   
/home/cagirici/Test/test.o: In function `main':
test.cpp:(.text+0x14): undefined reference to `CGAL::Random::Random()'
test.cpp:(.text+0x44): undefined reference to `CGAL::Random::Random(unsigned int)'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq_rep::Gmpq_rep()':
test.cpp:(.text._ZN4CGAL8Gmpq_repC2Ev[_ZN4CGAL8Gmpq_repC5Ev]+0x14): undefined reference to `__gmpq_init'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq_rep::~Gmpq_rep()':
test.cpp:(.text._ZN4CGAL8Gmpq_repD2Ev[_ZN4CGAL8Gmpq_repD5Ev]+0x14): undefined reference to `__gmpq_clear'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::Gmpq(int)':
test.cpp:(.text._ZN4CGAL4GmpqC2Ei[_ZN4CGAL4GmpqC5Ei]+0x46): undefined reference to `__gmpq_set_si'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::Gmpq(double)':
test.cpp:(.text._ZN4CGAL4GmpqC2Ed[_ZN4CGAL4GmpqC5Ed]+0x59): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL4GmpqC2Ed[_ZN4CGAL4GmpqC5Ed]+0x7a): undefined reference to `__gmpq_set_d'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator==(CGAL::Gmpq const&) const':
test.cpp:(.text._ZNK4CGAL4GmpqeqERKS0_[_ZNK4CGAL4GmpqeqERKS0_]+0x33): undefined reference to `__gmpq_equal'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator<(CGAL::Gmpq const&) const':
test.cpp:(.text._ZNK4CGAL4GmpqltERKS0_[_ZNK4CGAL4GmpqltERKS0_]+0x33): undefined reference to `__gmpq_cmp'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator==(int) const':
test.cpp:(.text._ZNK4CGAL4GmpqeqEi[_ZNK4CGAL4GmpqeqEi]+0x2e): undefined reference to `__gmpq_cmp_si'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator-() const':
test.cpp:(.text._ZNK4CGAL4GmpqngEv[_ZNK4CGAL4GmpqngEv]+0x3f): undefined reference to `__gmpq_neg'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator+=(CGAL::Gmpq const&)':
test.cpp:(.text._ZN4CGAL4GmpqpLERKS0_[_ZN4CGAL4GmpqpLERKS0_]+0x53): undefined reference to `__gmpq_add'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator-=(CGAL::Gmpq const&)':
test.cpp:(.text._ZN4CGAL4GmpqmIERKS0_[_ZN4CGAL4GmpqmIERKS0_]+0x53): undefined reference to `__gmpq_sub'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator*=(CGAL::Gmpq const&)':
test.cpp:(.text._ZN4CGAL4GmpqmLERKS0_[_ZN4CGAL4GmpqmLERKS0_]+0x53): undefined reference to `__gmpq_mul'
/home/cagirici/Test/test.o: In function `CGAL::Gmpq::operator/=(CGAL::Gmpq const&)':
test.cpp:(.text._ZN4CGAL4GmpqdVERKS0_[_ZN4CGAL4GmpqdVERKS0_]+0x50): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL4GmpqdVERKS0_[_ZN4CGAL4GmpqdVERKS0_]+0x94): undefined reference to `__gmpq_div'
/home/cagirici/Test/test.o: In function `CGAL::Real_embeddable_traits<CGAL::Gmpq>::To_interval::operator()(CGAL::Gmpq const&) const':
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0x1e): undefined reference to `mpfr_init2'
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0x41): undefined reference to `mpfr_set_q'
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0x52): undefined reference to `mpfr_get_d'
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0x82): undefined reference to `mpfr_set_q'
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0x93): undefined reference to `mpfr_get_d'
test.cpp:(.text._ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_[_ZNK4CGAL22Real_embeddable_traitsINS_4GmpqEE11To_intervalclERKS1_]+0xac): undefined reference to `mpfr_clear'
/home/cagirici/Test/test.o: In function `bool CGAL::get_certain<bool>(CGAL::Uncertain<bool>)':
test.cpp:(.text._ZN4CGAL11get_certainIbEET_NS_9UncertainIS1_EE[_ZN4CGAL11get_certainIbEET_NS_9UncertainIS1_EE]+0x3a): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `CGAL::Uncertain<bool>::Uncertain(bool, bool)':
test.cpp:(.text._ZN4CGAL9UncertainIbEC2Ebb[_ZN4CGAL9UncertainIbEC5Ebb]+0x5b): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `CGAL::Interval_nt<false>::Interval_nt(double, double)':
test.cpp:(.text._ZN4CGAL11Interval_ntILb0EEC2Edd[_ZN4CGAL11Interval_ntILb0EEC5Edd]+0x9a): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `CGAL::Interval_nt<false>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
test.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0xa1): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0x135): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `CGAL::Interval_nt<true>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
test.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0xa1): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0x135): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `std::back_insert_iterator<std::vector<CGAL::Object, std::allocator<CGAL::Object> > > CGAL::SphericalFunctors::intersect_3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >, std::back_insert_iterator<std::vector<CGAL::Object, std::allocator<CGAL::Object> > > >(CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >::Sphere_3 const&, CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >::Sphere_3 const&, CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >::Sphere_3 const&, std::back_insert_iterator<std::vector<CGAL::Object, std::allocator<CGAL::Object> > >)':
test.cpp:(.text._ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_[_ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_]+0x61): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_[_ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_]+0x9a): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_[_ZN4CGAL17SphericalFunctors11intersect_3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEESt20back_insert_iteratorISt6vectorINS_6ObjectESaISB_EEEEET0_RKNT_8Sphere_3ESJ_SJ_SF_]+0xd3): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `CGAL::SphereC3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > >::SphereC3(CGAL::Point_3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > > const&, CGAL::Gmpq const&, CGAL::Sign const&)':
test.cpp:(.text._ZN4CGAL8SphereC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC2ERKNS_7Point_3IS7_EERKS3_RKNS_4SignE[_ZN4CGAL8SphereC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC5ERKNS_7Point_3IS7_EERKS3_RKNS_4SignE]+0x84): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `bool CGAL::SphericalFunctors::non_oriented_equal<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > >(CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >::Sphere_3 const&, CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> >::Sphere_3 const&)':
test.cpp:(.text._ZN4CGAL17SphericalFunctors18non_oriented_equalINS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEEEEbRKNT_8Sphere_3ESC_[_ZN4CGAL17SphericalFunctors18non_oriented_equalINS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS4_EEEEEEbRKNT_8Sphere_3ESC_]+0x6a): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o: In function `std::back_insert_iterator<std::vector<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int>, std::allocator<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int> > > > CGAL::AlgebraicSphereFunctors::solve<CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq>, std::back_insert_iterator<std::vector<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int>, std::allocator<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int> > > > >(CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq>::Polynomial_for_spheres_2_3 const&, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq>::Polynomial_for_spheres_2_3 const&, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq>::Polynomial_for_spheres_2_3 const&, std::back_insert_iterator<std::vector<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int>, std::allocator<std::pair<CGAL::Root_for_spheres_2_3<CGAL::Gmpq>, unsigned int> > > >)':
test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0x99): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0xf8): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0x157): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0x1b6): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0x285): undefined reference to `CGAL::precondition_fail(char const*, char const*, int, char const*)'
/home/cagirici/Test/test.o:test.cpp:(.text._ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_[_ZN4CGAL23AlgebraicSphereFunctors5solveINS_32Algebraic_kernel_for_spheres_2_3INS_4GmpqEEESt20back_insert_iteratorISt6vectorISt4pairINS_20Root_for_spheres_2_3IS3_EEjESaISA_EEEEET0_RKNT_26Polynomial_for_spheres_2_3ESI_SI_SE_]+0x38d): more undefined references to `CGAL::precondition_fail(char const*, char const*, int, char const*)' follow
/home/cagirici/Test/test.o: In function `CGAL::CircleC3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > >::CircleC3(CGAL::Point_3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > > const&, CGAL::Gmpq const&, CGAL::Plane_3<CGAL::Spherical_kernel_3<CGAL::Cartesian<CGAL::Gmpq>, CGAL::Algebraic_kernel_for_spheres_2_3<CGAL::Gmpq> > > const&)':
test.cpp:(.text._ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC2ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE[_ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC5ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE]+0x7f): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC2ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE[_ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC5ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE]+0x1f0): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
test.cpp:(.text._ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC2ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE[_ZN4CGAL8CircleC3INS_18Spherical_kernel_3INS_9CartesianINS_4GmpqEEENS_32Algebraic_kernel_for_spheres_2_3IS3_EEEEEC5ERKNS_7Point_3IS7_EERKS3_RKNS_7Plane_3IS7_EE]+0x2c8): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 4 second(s))
42 error(s), 0 warning(s) (0 minute(s), 4 second(s))
g++-c/home/cagirici/Test/Test.cpp-o/home/cagirici/Test/Test.o
g++-o/home/cagirici/Test/Test/home/cagirici/Test/Test.o
/home/cagirici/Test/Test.o:在函数“main”中:
test.cpp:(.text+0x14):对“CGAL::Random::Random()”的未定义引用
test.cpp:(.text+0x44):对“CGAL::Random::Random(unsigned int)”的未定义引用
/home/cagirici/Test/Test.o:在函数“CGAL::Gmpq_rep::Gmpq_rep()”中:
test.cpp:(.text.ZN4CGAL8Gmpq_repC2Ev[ZN4CGAL8Gmpq_repC5Ev]+0x14):未定义对“uuuu gmpq”的引用
/home/cagirici/Test/Test.o:在函数“CGAL::Gmpq_rep::~Gmpq_rep()”中:
test.cpp:(.text.ZN4CGAL8Gmpq_repD2Ev[ZN4CGAL8Gmpq_repD5Ev]+0x14):未定义对“uu gmpq_clear”的引用
/home/cagirici/Test/Test.o:在函数“CGAL::Gmpq::Gmpq(int)”中:
test.cpp:(.text.ZN4CGAL4GmpqC2Ei[ZN4CGAL4GmpqC5Ei]+0x46):未定义对“uuuu gmpq\u set\u si”的引用
/home/cagirici/Test/Test.o:在函数“CGAL::Gmpq::Gmpq(double)”中:
test.cpp:(.text._ZN4CGAL4GmpqC2Ed[_ZN4CGAL4GmpqC5Ed]+0x59):对“CGAL::断言”的未定义引用失败(char const*,char const*,int,char const*)
test.cpp:(.text.ZN4CGAL4GmpqC2Ed[ZN4CGAL4GmpqC5Ed]+0x7a):未定义对`uuuu gmpq_uset_d'的引用
/home/cagirici/Test/Test.o:在函数'CGAL::Gmpq::operator==(CGAL::Gmpq const&)const'中:
test.cpp:(.text._znk4cGal4GmpqeRk0_[_znk4cGal4GmpqeRk0_]+0x33):未定义对“u_gmpq_equal”的引用

/home/cagirici/Test/Test.o:在函数`CGAL::Gmpq::operator中,如果您使用的是ros,则需要在cmake文件中添加您正在使用的库


在您的例子中,只需在编译时在文件名后添加
-lCGAL-lgmp-frounding math

在使用CMake编译CGAL示例时,我遇到了类似的链接错误。我可以通过使用

target\u link\u库(示例CGAL::CGAL)
而不是使用CMake变量

target\u link\u库(示例${CGAL\u库})


正如这里提到的:

您是否搜索过“未定义的引用”?您缺少-l标志。构建cgal应用程序的推荐方法是使用cmake,它为您添加了这些标志。@marglisse我不明白。我已经使用cmake进行了配置。但实际上,您应该查找与库链接的基础知识。您使用cmake配置了什么?CGAL还是你的项目?@pmr我使用了
cmake.
,然后我创建了一个
.cpp
文件,最后复制并粘贴了代码并按了run。