Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab


Chronological Thread 
  • From: Joachim Reichel <>
  • To:
  • Subject: Re: [cgal-discuss] how to compile mex-file based on CGAL in Matlab
  • Date: Mon, 14 Mar 2011 00:00:03 +0100

Hi,

> I have a problem to use mex in matlab to compile the "mexfile.cpp" in
> attachment. In matlab command windows, I use the following command:
>
>>> mex mexfile.cpp
> -I/usr/include/:/usr/local/include/:/opt/matlab/extern/include/
> -L/usr/lib/:/usr/local/lib/:/opt/matlab/extern/lib/glnxa64
>
>
> My CGAL and gmp install location is /usr/include/ and /usr/lib, my boost
> location is /usr/local/include/ and /usr/local/lib/
>
> But I can't complie it, can you give me some suggestion about it? Thanks
> very much!
> The compile result is following:*
>
>
> Warning: You are using gcc version "4.4.3-4ubuntu5)". The version
> currently supported with MEX is "4.2.3".
> For a list of currently supported compilers see:
> http://www.mathworks.com/support/compilers/current_release/
>
> mexfile.o: In function `CGAL::Handle_for<CGAL::Gmpq_rep,
> std::allocator<CGAL::Gmpq_rep> >::~Handle_for()':
> mexfile.cpp:(.text._ZN4CGAL10Handle_forINS_8Gmpq_repESaIS1_EED2Ev[CGAL::Handle_for<CGAL::Gmpq_rep,
> std::allocator<CGAL::Gmpq_rep> >::~Handle_for()]+0x18): undefined reference
> to `__gmpq_clear'
> mexfile.o: In function `boost::operator-(CGAL::Gmpq const&, CGAL::Gmpq
> const&)':
> mexfile.cpp:(.text._ZN5boostmiERKN4CGAL4GmpqES3_[boost::operator-(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x3e): undefined reference to `__gmpq_init'
> mexfile.cpp:(.text._ZN5boostmiERKN4CGAL4GmpqES3_[boost::operator-(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x60): undefined reference to `__gmpq_sub'
> mexfile.o: In function `boost::operator*(CGAL::Gmpq const&, CGAL::Gmpq
> const&)':
> mexfile.cpp:(.text._ZN5boostmlERKN4CGAL4GmpqES3_[boost::operator*(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x3e): undefined reference to `__gmpq_init'
> mexfile.cpp:(.text._ZN5boostmlERKN4CGAL4GmpqES3_[boost::operator*(CGAL::Gmpq
> const&, CGAL::Gmpq const&)]+0x60): undefined reference to `__gmpq_mul'
> mexfile.o: In function `CGAL::Same_uncertainty_nt<CGAL::Sign,
> CGAL::Gmpq>::type CGAL::orientationC2<CGAL::Gmpq>(CGAL::Gmpq const&,
> CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&,
> CGAL::Gmpq const&)':
> [...]

It seems that you do not link with the used libraries. You need at least
-lCGAL,
maybe also -lboost or -lgmp.

If it still does not work please show the linker command that is executed. I
don't know the mex tool, but I guess it has a mode that echoes the executed
commands.

Joachim



Archive powered by MHonArc 2.6.16.

Top of Page