I want to run a program I wrote that uses GMP library at my school, however I need your help getting this to work. The program itself is okay, but I can't figure out how to properly include GMP. I am using Netbeans IDE and cygwin, the program is in c++. Can anybody give me an insight on how to do this? There are a lot of things I'm uncertain about, e.g:
- Do I need to compile specifically for that computer?
- Does the OS matter?
I'm sorry if this is question is answered somewhere already. I have googled for quite some time but I can't seem to find anything, not even an example from GMP itself.
Thanks in advance!
Edit:
I really can't find out how to link this. The program crashes instantly and dumps a stacktrace. It says: Exception: STATUS_ILLEGAL_INSTRUCTION. In the folder I have cyggcc_s-seh-1.dll, cyggmp-10.dll, cygstdc++=6.dll, cygwin1.dll, the exe, gmpxx.h, libgmp.a, libgmp.la, libgmp.lai, libgmp.libcmd, libgmpxx.a, libgmpxx.la, libgmpxx.lai, main.cpp, main.o, main.o.d, .dep.inc and some files and folders necessary for my program.
I have included gmp and gmpxx, when I build it gives:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/e/Documents/NetBeansProjects/GeneticPrimesFast'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/geneticprimesfast.exe
make[2]: Entering directory '/cygdrive/e/Documents/NetBeansProjects/GeneticPrimesFast'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f "build/Debug/Cygwin_4.x-Windows/main.o.d"
g++ -c -g -Werror -I../../GMP/gmp-6.0.0 -std=c++11 -MMD -MP -MF "build/Debug/Cygwin_4.x-Windows/main.o.d" -o build/Debug/Cygwin_4.x-Windows/main.o main.cpp
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/geneticprimesfast build/Debug/Cygwin_4.x-Windows/main.o -lgmpxx -lgmp
make[2]: Leaving directory '/cygdrive/e/Documents/NetBeansProjects/GeneticPrimesFast'
make[1]: Leaving directory '/cygdrive/e/Documents/NetBeansProjects/GeneticPrimesFast'
BUILD SUCCESSFUL (total time: 2s)
I'm quite stressed right now, since I need this to work tomorrow. Any help would be very much appreciated!
Edit 2:
I've come to the conclusion that n.m. is probably right: it has to do with the code. What are typical things that cause illegal instructions?
Edit 3:
Thanks for your help! I found out it has to do with the get_str command in gmp (and possibly also get_d). Does anyone know another way of getting a string without this function, or am I using it wrong?
Edit 4:
mpf_set_d also doesn't work. It is essential for the program. Does anyone know how to fix this or where I'm going wrong? Maybe the development tool, and how would I check that?