I put the gmpxx.h
and gmp.h
files into the folder ./proj/include/gmp
and I include them into files located at path ./proj/src/file.cpp
or ./proj/test/test.cpp
.
This is the content of my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.18)
enable_language(CXX)
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 0)
SET(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -lgmpxx -lgmp")
include(CMakeToolsHelpers OPTIONAL)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
include_directories(include/gmp)
But, when I try to build the project the compiler return me this error:
ld: library not found for -lgmpxx
collect2: error: ld returned 1 exit status
I also tried to install directly the library but the installation faild. How can I fix the problem?