![]() |
![]() |
#1 |
Sep 2020
5 Posts |
![]()
Guys, I need your help because I cannot find the end of this nightmare.
Target : use an easy C IDE in order to develop a software that invilves big numbers, through the library GMP Software used : CodeLite IDE -------------------------------------------- Issues : I downloaded the GMP library package (6.2.1) and I cannot literally use it. I am working under Windows 10. Basically I unzipped the gmp package into my desktop and this is my program : Code:
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <assert.h> #include "C:\Users\davin\Desktop\gmp-6.2.1\gmpxx.h" int main() { int i; mpz_t a; printf("hello world\n"); return 0; } First : Why the header should be GMP.H and it is not present ? I see only GMPXX.H and I am using C, not C++ Second : I try to build and I get an error that says that the library "iosfwd" is not present. This error is inside the gmpxx.h I haven't found any way to get the rid of this... Why is it so complicated to use a library with a normal IDE ? Thanks in advance for your help |
![]() |
![]() |
![]() |
#2 |
∂2ω=0
Sep 2002
República de California
5·2,351 Posts |
![]()
I can't help you with Windows-specific stuff, but just looking at one of my Intel/Linux boxes where I compile and run GMP-using C code:
Code:
ls -l /usr/include/gmp* -rw-r--r-- 1 root root 116607 Dec 1 2018 /usr/include/gmpxx.h ls -l /usr/include/*/gmp* -rw-r--r-- 1 root root 83776 Dec 1 2018 /usr/include/x86_64-linux-gnu/gmp.h |
![]() |
![]() |
![]() |
#3 |
Apr 2010
5·31 Posts |
![]()
gmpxx.h is GMP's C++ wrapper. It includes further C++ headers which a C compiler is not meant to be able to find or use.
Therefore the message about not finding iosfwd. You want gmp.h instead. If I recall correctly, gmp.h is created only after you have run GMP's configure script. Then the GMP library itself needs to be built. Only then you will be able to link with it. |
![]() |
![]() |
![]() |
#4 |
Apr 2010
5×31 Posts |
![]()
Just in case: If you wonder how to run GMP's configure script under Windows:
If you use Git for Windows (and you should), that comes with a lot of Unix-y tools (bash, coreutils, perl etc). So you can run GMP's configure from the Git bash prompt. |
![]() |
![]() |
![]() |
#5 |
Dec 2005
52 Posts |
![]()
It looks like CodeLite is based on (or can use) MSYS2 and the MinGW64 compiler suite. There is documentation on their website:
https://docs.codelite.org/build/mingw_builds/ A pre-compiled GMP library can be downloaded inside MSYS2. Install MSYS2 as documented on the link. The command to download the required files for GMP is "pacman -Sy libgmp-dev". If that doesn't work, let me know. casevh |
![]() |
![]() |
![]() |
#6 |
Dec 2005
52 Posts |
![]()
I have it working. Here are the steps I followed.
1. Install the CodeLite IDE. 2. Follow the instructions at https://docs.codelite.org/build/mingw_builds/ to install the mingw-w64 compilers. The exact steps are: 2.1. Install MSYS2 2.2. At first start of the MSYS2 terminal, run "pacman -Syuu" 2.3. At second start of the MSYS2 terminal run the "pacman -Sy mingw ..." command from the web page. 3. Start CodeLite and update the Build settings to use the compiler provided by MSYS2. https://docs.codelite.org/settings/build_settings/ The path for the compiler is C:/msys64/mingw64 I created a project with the main.c as Code:
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <assert.h> #include <gmp.h> int main() { int i; mpz_t a; printf("hello world\n"); return 0; } casevh |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OPN Library website | ThomRuley | Factoring | 9 | 2021-01-04 13:40 |
error with gmp-ecm library | bhelmes | Software | 2 | 2020-04-30 20:21 |
Using YAFU as a C-library | LangerJan | YAFU | 2 | 2013-02-17 06:18 |
Quickest fft library | nuggetprime | Software | 3 | 2011-01-09 01:24 |
GWNUM library | bearnol | Software | 6 | 2006-02-24 11:19 |