将CGAL与Code :: Blocks一起使用

时间:2014-06-21 15:24:12

标签: c++ compiler-errors cgal

我尝试运行this代码,但我收到了很多undefined reference错误。

这是错误日志:

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))

为什么我会收到undefined reference错误?

2 个答案:

答案 0 :(得分:4)

如果您正在使用ros,则需要在cmake文件中添加您正在使用的库。

在您的情况下,只需在编译时在文件名后添加-lCGAL -lgmp -frounding-math

答案 1 :(得分:1)

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

解决它

target_link_libraries(example CGAL::CGAL)而不是使用CMake变量

target_link_libraries(example ${CGAL_LIBRARIES})

如此处所述:https://github.com/CGAL/cgal/wiki/How-to-use-CGAL-with-CMake-or-your-own-build-system