Cannot use gmp and mpfr
Answered
I am trying to compile the following code from CGAL website: https://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2for_loop_2_8cpp-example.html
It compiles perfectly from commandline in Mac 10.15.7. I am simply using g++ -std=c++17 -lgmp -lmpfr main.cpp. The I can run the program using ./a.out
But it is not working from Clion. I am using the following in CMake options under Preferences:
-DCMAKE_CXX_FLAGS="-O3 -Wall -Wextra -I/usr/local/include".
If I include -lgmp and lmpfr, looks like they are not recognized.
Any help will be appreciated.
Please sign in to leave a comment.
Hello!
You need to link gmp and mpfr libraries using the find_package() and target_link_libraries() CMake commands. Please see https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html#boost and, for example, https://stackoverflow.com/a/29309437/11988753