[Solved] CGAL compiling error undefined reference to `CGAL::assertion_fail

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

[Solved] CGAL compiling error undefined reference to `CGAL::assertion_fail

runningterp
This post was updated on .
I just started to learn CGAL. After downloading CGAL-4.9 into my Ubuntu14.04 on Virtualbox, I installed it following the http://doc.cgal.org/latest/Manual/installation.html, then I wrote a.cpp with nothing but only include <CGAL/convex_hull_2.h> . I then used the following command to compile it:

g++ -frounding-math -lCGAL -lCGAL_Core a.cpp

but I got the following error message:

/tmp/ccbCdUjo.o: In function `CGAL::Interval_nt<false>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
a.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0xb7): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
a.cpp:(.text._ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb0EE27Test_runtime_rounding_modesC5Ev]+0x161): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
/tmp/ccbCdUjo.o: In function `CGAL::Interval_nt<true>::Test_runtime_rounding_modes::Test_runtime_rounding_modes()':
a.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0xb7): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
a.cpp:(.text._ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC2Ev[_ZN4CGAL11Interval_ntILb1EE27Test_runtime_rounding_modesC5Ev]+0x161): undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
collect2: error: ld returned 1 exit status

It is weird since the error like CGAL::assertion_fail should result from forgetting -lCGAL, but I did -lCGAL and I checked that my libCGAL.so is in the directory /usr/local/lib/x86_64-linux-gnu . I also tried to specify the path by using:

g++ -I /home/osboxes/CGAL-4.9/include -lCGAL -L /home/osboxes/CGAL-4.9/lib/ a.cpp

but this doesn't help neither. So I am totally lost, and I really hope someone could help me to resolve this problem.
Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: CGAL compiling error undefined reference to `CGAL::assertion_fail

Marc Glisse
On Mon, 10 Oct 2016, runningterp wrote:

> I just started to learn CGAL. After downloading CGAL-4.9 into my Ubuntu14.04
> on Virtualbox, I installed it following the
> http://doc.cgal.org/latest/Manual/installation.html, then I wrote a.cpp with
> nothing but only include <CGAL/convex_hull_2.h> . I then used the following
> command to compile it:
>
> g++ -frounding-math -lCGAL -lCGAL_Core a.cpp

The order of the arguments matters, this one is wrong.

--
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: CGAL compiling error undefined reference to `CGAL::assertion_fail

runningterp
This post was updated on .
Marc Glisse wrote
On Mon, 10 Oct 2016, runningterp wrote:

> I just started to learn CGAL. After downloading CGAL-4.9 into my Ubuntu14.04
> on Virtualbox, I installed it following the
> http://doc.cgal.org/latest/Manual/installation.html, then I wrote a.cpp with
> nothing but only include <CGAL/convex_hull_2.h> . I then used the following
> command to compile it:
>
> g++ -frounding-math -lCGAL -lCGAL_Core a.cpp

The order of the arguments matters, this one is wrong.

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

Thank you very much.
I just tried:  g++ -frounding-math -lCGAL -lCGAL_Core a.cpp , but I still got the same error. Could you please explain in details?

Edit:
Now I understand what you mean. I used: g++ -frounding-math a.cpp -lCGAL , then it works. The tutorial https://parasol.tamu.edu/~amato/Courses/620/cgal/cgal-tutorial.pdf is really misleading here. Thanks a lot!