Linking GMP Library into CLion
Completed
Hi, I installed GMP library into my Windows system with " C:/gmp" prefix by using these instructions. After that, i changed the contents of my "CMakeLists.txt" file with the contents below.
But I still get an error with "undefined reference" warning and I'm having trouble finding solutions about this on the web. Can you help me with this problem?
Thanks.
cmake_minimum_required(VERSION 3.6)
project(cs50)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp functions.cpp)
add_executable(cs50 ${SOURCE_FILES})
include_directories("C:/gmp/include")
target_link_libraries(cs50 "C:/gmp/lib/libgmp.a")
Please sign in to leave a comment.
Okay, it is fixed after changing the cmake.txt file into this;
If you are on Windows and using Cygwin as your tool chain, start Cygwin Setup and grab to the bin and src for...
Let that download and install.
Now, in your CmakeLists.txt file add the line
Now you'll be able to include and compile with #include <gmp.h>.
I hope this helps.