I downloaded libtommath zip file
Now how do I start using it?
I am using gcc in windows 7
Please help
Thank you very much
I downloaded libtommath zip file
Now how do I start using it?
I am using gcc in windows 7
Please help
Thank you very much
I suppose I could start by making a project, including all the files in libtommath in that project and hitting build
But I have another problem
I also downloaded tomsfastmath libraryfrom the same website, and it includes projects for Visual C and Visual Studio 2005 and 2008. I imported them to codeblocks and hit build. All the files compile properly, but at the end I get a message saying "You must select host application to run a library". What does this mean?
In other words, you have a library, but you need to use the library in a program in order for it to be err... useful.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Yes, exactly
Please tell me how I should start
Perhaps I could look at the big number function implementations in this library and try to write my own on their basis, but that would take too long (since the library contains processor specific codes to make certain routines run faster on certain processors)
I just want to be able to create variables that can hold large numbers, so that I can use them in my own implementation of some algorithms such as Montgomery reduction and few others
The Bignum library here: The GNU MP Bignum Library
has some good documentation on how to use it.
I have already had a lot of problems trying to install it in Windows
Moreover I don't know if it compiles in gcc, another tutorial on the web says it need to be compiled under MS VC++ 6.0
I can at least get it to install and run a sample program in Linux but it would be much more convenient for me if I could do it in Windows 7
First you need to set your compiler to build a STATIC LIBRARY and compile the library itself.
Then you use the header files .h from it like you use stdlib.h and string.h in your regular programs.
It's not a program by itself.
so how do I set my compiler to build a static library?
The last post would have been more helpful and would have saved much more time if it contained some actual references, like Creating a shared and static library with the gnu compiler [gcc] and The GNU C Programming Tutorial
Anyway after I create the library, when trying to use it in a sample program demo.c as provided by the creators of the libtommath library this is what I get in codeblocks after I build the project
What does this mean? Does this mean there was a problem when the library was created or is it something else?Code:-------------- Build: Debug in ltm_test --------------- Compiling: demo.c mingw32-gcc.exe: libraries\LibTom: No such file or directory mingw32-gcc.exe: projects\ltm-0.42.0\ltm_library: No such file or directory mingw32-gcc.exe: and: No such file or directory mingw32-gcc.exe: headers\test\demo.c -o obj\Debug\demo.o: No such file or directory mingw32-gcc.exe: no input files Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings
Could this be possible because of some inappropriate settings in Codeblocks?
Thanks in advance
Last edited by mahaju; 12-28-2011 at 06:32 AM.
And exactly how does it turn out that we are to do your work for you?
What did that take you... maybe 15 seconds on Google?
If you have a problem or there's something you just don't understand that's one thing. But don't be criticising people how do this strictly out of kindness when they expect you to make a reasonable effort on your own.
Really....
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Okay, there is a makefile. You don't have to do anything to create the library:
/libtommath-0.42.0> make
Now there's tons of .o files around, but also, libtommath.a. I copied that into the "demo" directory (you can make the demo automatically with "make test", but we want to see how to use the lib). I also copied the "tommath.h" into there. I then had to put "tommath_class.h" and "tommath_superclass.h" into my include path. Then:
/libtommath-0.42.0/demo> gcc libtommath.a demo.c
Compiles fine. I'm not sure what the executable is supposed to do, but it runs.
This is exactly the same on windows. Again, if you can understand these few simple steps, you have everything you need to use the library. Getting it to then work with codeblocks is just applying that to codeblocks, which I don't use, but you at least now have something straightforward to eg, ask someone else who does use codeblocks how to apply.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Thank you very much
I have also produced the .a file, however, I did that by compiling all the .c files in codeblocks (I wasn't sure how to combine multiple files in command line so I used Codeblocks for compiling, which has an option of making a static library project)
The next step, linking it with the demo.c file was creating problems in codeblocks and I am still working on it
Thank you very much for your time and effort
Also in your code you have just entered the name of the library and c file for compiling, but I thought we needed the -l<name> parameter for linking the libraries. Also, did you just leave out the -o option in this post only or you didn't give it at all?