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....
[from a post which was then deleted...huh]
Of course, lol. Looks like today is the day you learn some things about your toolchain of choice.
I downloaded tomsfastmath from here:
LibTom Projects
I don't see any VS project files or whatever in there, but I wouldn't know what they look like anyway. I do notice in the nice PDF file inside the doc directory:
So I dunno what the tutorials you've been reading smoked recently.Originally Posted by 1.3 Building
However, there is a makefile in the top level. Ran "make" and this left libtfm.a in the toplevel, which is a static library. Rather than use "make install", I copied tfm.h from the headers directory into my include path. I copied libtfm.a into my own test build directory along with this:
Which uses some simple functions and macros I found in Chapter 3 of the pdf. Then I compiled:Code:#include <stdio.h> #include <tfm.h> int main(void) { fp_int test; fp_init(&test); printf("%d %d\n", fp_iszero(&test), fp_isodd(&test)); return 0; }
root/C> gcc mycode.c libtfm.a
root/C> ./a.out
1 0
So that works. It should be exactly the same thing on windows. I can't help you with codeblocks, tho.
I believe mingw comes with "make" but can't remember. If not:
Make for Windows
Will make your life much easier WRT to tomsfastmath since that seems to be the preferred build method.
Last edited by MK27; 12-28-2011 at 06:52 AM.
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
I'm sorry I made some mistakes
The VS project files are in libtommath and not tomsfastmath
the latest post about errors in Codeblocks were for libtommath and not tomsfastmath
I haven't been able to compile tomsfastmath into a library yet
I was able to make a .a file from the libtommath code files, and I think I have properly set codeblocks up to find the library as well as the associated header files, but when I use it with the demo file it shows that error
I am sure this would compile relatively easily in Linux, I have already got gmp to work in Linux, but the source code in this library seems a bit easier to understand and when I first heard abouth this library I thought it would build easily with Windows, so had decided to check it out, but it's not working
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.