Cannot makefile Nef_3 examples

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot makefile Nef_3 examples

Shrabani Ghosh
I am trying to compile and run a single program but I am getting this error
for every problem to makefile.

CMakeFiles/comparison.dir/comparison.cpp.o: In function `std::ostream&
operator<< <__mpz_struct [1], __mpz_struct [1]>(std::ostream&,
__gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&)':
comparison.cpp:(.text._ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E[_ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E]+0x32):
undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
collect2: error: ld returned 1 exit status
CMakeFiles/comparison.dir/build.make:98: recipe for target 'comparison'
failed
make[2]: *** [comparison] Error 1
CMakeFiles/Makefile2:739: recipe for target 'CMakeFiles/comparison.dir/all'
failed
make[1]: *** [CMakeFiles/comparison.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Cannot makefile Nef_3 examples

Sebastien Loriot (GeometryFactory)
Did you link with gmp and mpfr?

On 9/23/19 6:23 PM, Shrabani Ghosh wrote:

> I am trying to compile and run a single program but I am getting this error
> for every problem to makefile.
>
> CMakeFiles/comparison.dir/comparison.cpp.o: In function `std::ostream&
> operator<< <__mpz_struct [1], __mpz_struct [1]>(std::ostream&,
> __gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&)':
> comparison.cpp:(.text._ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E[_ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E]+0x32):
> undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
> collect2: error: ld returned 1 exit status
> CMakeFiles/comparison.dir/build.make:98: recipe for target 'comparison'
> failed
> make[2]: *** [comparison] Error 1
> CMakeFiles/Makefile2:739: recipe for target 'CMakeFiles/comparison.dir/all'
> failed
> make[1]: *** [CMakeFiles/comparison.dir/all] Error 2
> Makefile:94: recipe for target 'all' failed
> make: *** [all] Error 2
>
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Cannot makefile Nef_3 examples

Marc Glisse
On Tue, 24 Sep 2019, Sebastien Loriot (GeometryFactory) wrote:

> Did you link with gmp and mpfr?

And gmpxx?

> On 9/23/19 6:23 PM, Shrabani Ghosh wrote:
>> I am trying to compile and run a single program but I am getting this error
>> for every problem to makefile.
>>
>> CMakeFiles/comparison.dir/comparison.cpp.o: In function `std::ostream&
>> operator<< <__mpz_struct [1], __mpz_struct [1]>(std::ostream&,
>> __gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&)':
>> comparison.cpp:(.text._ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E[_ZlsIA1_12__mpz_structS1_ERSoS2_RK10__gmp_exprIT_T0_E]+0x32):
>> undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
>> collect2: error: ld returned 1 exit status
>> CMakeFiles/comparison.dir/build.make:98: recipe for target 'comparison'
>> failed
>> make[2]: *** [comparison] Error 1
>> CMakeFiles/Makefile2:739: recipe for target 'CMakeFiles/comparison.dir/all'
>> failed
>> make[1]: *** [CMakeFiles/comparison.dir/all] Error 2
>> Makefile:94: recipe for target 'all' failed
>> make: *** [all] Error 2

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Cannot makefile Nef_3 examples

Shrabani Ghosh
Yes, I have built mpfr and gmp separately and linked to the program.
Below is the cmakelist file and program. Do you think I did it correct?

# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cmakelist file

project( executable )


cmake_minimum_required(VERSION 2.8.11)

# CGAL and its components
find_package( CGAL QUIET COMPONENTS  )

if ( NOT CGAL_FOUND )

  message(STATUS "This project requires the CGAL library, and will not be
compiled.")
  return()  

endif()

# include helper file
include( ${CGAL_USE_FILE} )


# Boost and its components
find_package( Boost REQUIRED )
find_package( GMP REQUIRED )
find_package( MPFR REQUIRED )

if ( NOT Boost_FOUND )

  message(STATUS "This project requires the Boost library, and will not be
compiled.")

  return()  

endif()

# include for local directory

# include for local package


# Creating entries for target: executable
# ############################

add_executable( executable  comparison.cpp )

add_to_cached_list( CGAL_EXECUTABLE_TARGETS executable )

# Link the executable to CGAL and third-party libraries
target_link_libraries(executable   ${CGAL_LIBRARIES}
${CGAL_3RD_PARTY_LIBRARIES} )
target_link_libraries(executable   ${GMP_HOME} ${MPFR_HOME} )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cpp file



#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <gmp.h>
#include <gmpxx.h>
#include <mpfr.h>
using namespace std;
typedef CGAL::Exact_integer  NT;
typedef CGAL::Extended_homogeneous<NT>  Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel>  Nef_polyhedron;
//typedef Nef_polyhedron::Plane_3  Plane_3;
typedef Kernel::Plane_3 Plane_3;
int main() {

  Nef_polyhedron N1(Plane_3(2,5,7,11), Nef_polyhedron::INCLUDED);
  Nef_polyhedron N2(Plane_3(2,5,7,11), Nef_polyhedron::EXCLUDED);

  CGAL_assertion(N1 >= N2);
  CGAL_assertion(N2 <= N1);
  CGAL_assertion(N1 != N2);
  CGAL_assertion(N1 > N2);
  CGAL_assertion(N2 < N1);

  N2 = N2.closure();
  CGAL_assertion(N1==N2);
  CGAL_assertion(N1>=N2);
  CGAL_assertion(N1<=N2);

  return 0;
}




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Cannot makefile Nef_3 examples

Sebastien Loriot (GeometryFactory)
I think you should take a CMakeLists.txt from the example directory
of Nef, copy/paste it and adapt it to your exe.

Sebastien.

On 9/24/19 4:40 PM, Shrabani Ghosh wrote:

> Yes, I have built mpfr and gmp separately and linked to the program.
> Below is the cmakelist file and program. Do you think I did it correct?
>
> # Created by the script cgal_create_CMakeLists
> # This is the CMake script for compiling a set of CGAL applications.
>
>
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> cmakelist file
>
> project( executable )
>
>
> cmake_minimum_required(VERSION 2.8.11)
>
> # CGAL and its components
> find_package( CGAL QUIET COMPONENTS  )
>
> if ( NOT CGAL_FOUND )
>
>    message(STATUS "This project requires the CGAL library, and will not be
> compiled.")
>    return()
>
> endif()
>
> # include helper file
> include( ${CGAL_USE_FILE} )
>
>
> # Boost and its components
> find_package( Boost REQUIRED )
> find_package( GMP REQUIRED )
> find_package( MPFR REQUIRED )
>
> if ( NOT Boost_FOUND )
>
>    message(STATUS "This project requires the Boost library, and will not be
> compiled.")
>
>    return()
>
> endif()
>
> # include for local directory
>
> # include for local package
>
>
> # Creating entries for target: executable
> # ############################
>
> add_executable( executable  comparison.cpp )
>
> add_to_cached_list( CGAL_EXECUTABLE_TARGETS executable )
>
> # Link the executable to CGAL and third-party libraries
> target_link_libraries(executable   ${CGAL_LIBRARIES}
> ${CGAL_3RD_PARTY_LIBRARIES} )
> target_link_libraries(executable   ${GMP_HOME} ${MPFR_HOME} )
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> cpp file
>
>
>
> #include <CGAL/Exact_integer.h>
> #include <CGAL/Extended_homogeneous.h>
> #include <CGAL/Nef_polyhedron_3.h>
> #include <gmp.h>
> #include <gmpxx.h>
> #include <mpfr.h>
> using namespace std;
> typedef CGAL::Exact_integer  NT;
> typedef CGAL::Extended_homogeneous<NT>  Kernel;
> typedef CGAL::Nef_polyhedron_3<Kernel>  Nef_polyhedron;
> //typedef Nef_polyhedron::Plane_3  Plane_3;
> typedef Kernel::Plane_3 Plane_3;
> int main() {
>
>    Nef_polyhedron N1(Plane_3(2,5,7,11), Nef_polyhedron::INCLUDED);
>    Nef_polyhedron N2(Plane_3(2,5,7,11), Nef_polyhedron::EXCLUDED);
>
>    CGAL_assertion(N1 >= N2);
>    CGAL_assertion(N2 <= N1);
>    CGAL_assertion(N1 != N2);
>    CGAL_assertion(N1 > N2);
>    CGAL_assertion(N2 < N1);
>
>    N2 = N2.closure();
>    CGAL_assertion(N1==N2);
>    CGAL_assertion(N1>=N2);
>    CGAL_assertion(N1<=N2);
>
>    return 0;
> }
>
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss