Thread: C++ libraries

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    103

    C++ libraries

    I'm trying to use this library: C++ Big Integer Library - Matt McCutchen's Web Site

    But, I have nooo idea how to start using it.

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    I'm trying to use this library: C++ Big Integer Library - Matt McCutchen's Web Site

    But, I have nooo idea how to start using it. I mean, how would I include the library?

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You don't include a library, ever, at any point. After your program is compiled, you need to link the library with your code. How you do that depends on your system.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    Ubuntu (9.04) so Linux basically.

    G++ ( I zink latest version)

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Then presumably you've got lib<whatever>.a somewhere. If you're on the command line, then just add -l<whatever> to the end of your command line, or the end of the final compilation command in your Makefile.

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    Quote Originally Posted by tabstop View Post
    Then presumably you've got lib<whatever>.a somewhere. If you're on the command line, then just add -l<whatever> to the end of your command line, or the end of the final compilation command in your Makefile.
    I don't have any file ending in ".a" in the zip file I downloaded...

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    So I had to break down and look at the library you refer to. Apparently there's not so much a library as a bunch of object files. Whichever object files you need, you can incorporate into your program, then. (You don't need -l; just put the .o files in with your .o files when you create the program.)

  8. #8
    Registered User
    Join Date
    Jan 2009
    Posts
    103
    Can you please tell me the exact command for gcc?

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Poincare View Post
    Can you please tell me the exact command for gcc?
    I could, but I don't know how much good it will do any of us, since I'd be quoting you -- the exact command is "gcc". In other words, instead of typing
    Code:
    gcc myfile1 myfile2 myfile3 -o exectuable
    you'd type
    Code:
    gcc myfile1 myfile2 myfile3 hisfile1 hisfile2 -o executable
    which does not require any additional anything on anybody's part.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GCC: Compiling with both static and shared libraries
    By eatwithaspork in forum C Programming
    Replies: 4
    Last Post: 06-23-2008, 01:48 PM
  2. Replies: 7
    Last Post: 05-13-2008, 03:47 AM
  3. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  4. Libraries and headers
    By darksaidin in forum C++ Programming
    Replies: 10
    Last Post: 07-23-2003, 06:24 AM
  5. QT and external libraries
    By Quacker in forum Linux Programming
    Replies: 1
    Last Post: 04-08-2003, 07:02 AM