PDA

View Full Version : Including GMP in Qt-Project



tillorgias
3rd July 2010, 17:21
Hi there,

I have a problem, which is a general Qt/C++-Question: How do I include an external library (adding it to the include path)?

In this case I want to include GMP-Library. I think the answer is very simple, but I don't get it work.
I'm using Linux Ubuntu 10.4 and M$ Windows, but I think this question is platform independent.

Please help me,
Tillorgias

Talei
3rd July 2010, 18:47
Something along these lines:

win32:INCLUDEPATH += C:\Qt\libs\zlib-1.2.5

#INCLUDEPATH - add here path to the SRC that will NEVER change i.e. system src etc.
#DEPENDPATH - add here SRC that WILL CHANGE, to trigger BUILD!

in pro file

tillorgias
3rd July 2010, 19:18
Hi,

thanks for the help. But do you know WHICH paths are needed for using GMP-Library (on Ubuntu)? That would help a lot because I never worked with external libs before.

Tillorgias

tillorgias
3rd July 2010, 20:55
OK. I now installed GMP completely. But once I compile it, I get the following (linker-)errors:



main.o: In function `initializeGMP()':
main.cpp:(.text+0x3e): undefined reference to `__gmpz_init'
main.cpp:(.text+0x4a): undefined reference to `__gmpz_init'
main.cpp:(.text+0x56): undefined reference to `__gmpz_init'
main.cpp:(.text+0x62): undefined reference to `__gmpz_init'
main.cpp:(.text+0x6e): undefined reference to `__gmpz_init'
main.o: In function `RSA_checkKeys()':
main.cpp:(.text+0x21f): undefined reference to `__gmpz_set_str'
main.cpp:(.text+0x237): undefined reference to `__gmpz_set_str'
main.cpp:(.text+0x255): undefined reference to `__gmpz_set_str'
main.o: In function `clearGMP()':
main.cpp:(.text+0x28e): undefined reference to `__gmpz_clear'
main.cpp:(.text+0x29a): undefined reference to `__gmpz_clear'
main.cpp:(.text+0x2a6): undefined reference to `__gmpz_clear'
main.cpp:(.text+0x2b2): undefined reference to `__gmpz_clear'
main.cpp:(.text+0x2be): undefined reference to `__gmpz_clear'
main.o: In function `RSA_generateKeys()':
main.cpp:(.text+0x347): undefined reference to `__gmpz_init'
main.cpp:(.text+0x355): undefined reference to `__gmpz_init'
main.cpp:(.text+0x461): undefined reference to `__gmpz_set_str'
main.cpp:(.text+0x47b): undefined reference to `__gmpz_set_str'
main.cpp:(.text+0x48d): undefined reference to `__gmpz_nextprime'
...


I am using the Qt Creator.

Please help...