Like Tree1Likes

how do I use/install libtommath?

This is a discussion on how do I use/install libtommath? within the C Programming forums, part of the General Programming Boards category; I downloaded libtommath zip file Now how do I start using it? I am using gcc in windows 7 Please ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    36

    how do I use/install libtommath?

    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

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    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?
    Attached Images Attached Images  

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,640
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    Yes, exactly
    Please tell me how I should start

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    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

  6. #6
    Registered User
    Join Date
    Nov 2011
    Posts
    86
    The Bignum library here: The GNU MP Bignum Library
    has some good documentation on how to use it.

  7. #7
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    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

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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.

  9. #9
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    so how do I set my compiler to build a static library?

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by mahaju View Post
    so how do I set my compiler to build a static library?
    Geee... wouldn't be wonderful if there was some place you could look this kind of thing up? Some kind of, gosh I dunno... "Help File" or something?

  11. #11
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    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


    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
    What does this mean? Does this mean there was a problem when the library was created or is it something else?
    Could this be possible because of some inappropriate settings in Codeblocks?
    Thanks in advance
    Last edited by mahaju; 12-28-2011 at 05:32 AM.

  12. #12
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by mahaju View Post
    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
    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....

  13. #13
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by mahaju View Post
    Could this be possible because of some inappropriate settings in Codeblocks?
    [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:

    Quote Originally Posted by 1.3 Building
    1.3.2
    MSVC
    The library doesn’t build with MSVC. Imagine that.
    So I dunno what the tutorials you've been reading smoked recently.

    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:

    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;
    }
    Which uses some simple functions and macros I found in Chapter 3 of the pdf. Then I compiled:

    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 05: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

  14. #14
    Registered User
    Join Date
    Dec 2011
    Posts
    36
    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

  15. #15
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How I do install SDL?
    By gibbofresco in forum Game Programming
    Replies: 11
    Last Post: 09-25-2006, 10:38 PM
  2. Install
    By Scarvenger in forum C++ Programming
    Replies: 3
    Last Post: 10-24-2005, 10:33 AM
  3. DOS install
    By jrahhali in forum Tech Board
    Replies: 9
    Last Post: 03-05-2004, 12:47 AM
  4. How i must install SDL?
    By SuRaNa in forum C++ Programming
    Replies: 1
    Last Post: 12-23-2002, 01:35 AM
  5. install
    By bob20 in forum Windows Programming
    Replies: 3
    Last Post: 12-05-2002, 08:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21