Archived

This topic is now archived and is closed to further replies.

OctDev

C++ Libraries

Recommended Posts

I''m wondering what free libraries people use in their code? I am interested in something similar to Sun''s JFC for Java. I am primarily interested in libraries that can be directly used in game development. I plan on using OpenGL and Glut already. I was recently pointed towards SDL, which I will explore for some audio routines. I am also very interested in some heavy duty data structure libraries, that are well tested and well optimized, as I''d prefer not to rewrite all the ones from CS classes that I lost track of after switching to Java for a while. Anyway, any names or links would be greatly appreciated. Thanx alot. --OctDev

Share this post


Link to post
Share on other sites
The C++ standard library comes with the standard template library, which has an excellent linked list and a very decent dictionary (they call it "map") class for you. STL has a steep initial learning curve, but once you understand the basics (containers, iterators, adapters, functors), you know the entire library.

There are some non-standard versions of STL (would that be NSTL? hehehe) that also implement a hash table. I believe SGI''s does this, though I''ve always stuck with MSVC''s implementation so I can''t say for sure.

Share this post


Link to post
Share on other sites
Yup, SGI STL implements a "hash-map", that and some more new "goodies".


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album

Share this post


Link to post
Share on other sites
Yeah. I can back the use of the STL (now part of the standard C++ library) for most of your data structure needs. And the SDL seems quite nice for game programming, if you don''t mind working at a reasonably low level (higher level than plain DirectX, but still having to deal with blitting and drawing pixels yourself). I''ve not needed any other library for any of my work.

Share this post


Link to post
Share on other sites
I should mention that I too (?) use SDL. And to be honest I wouldn''t like it as much as I do if it were more high-level. Low-level libraries often if not always comes with so much more flexibility and power.
I use the STL as well, and I''m going to use OpenGL if I need to utilize the 3D accelerator. I might also, if I ever get so far in a project, use a third party MP3/Vorbis decoding library. Be it the official Vorbis SDK, SMPEG or Xaudio.


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album

Share this post


Link to post
Share on other sites
Thanx Guys!!! That''s exactly the type of info I was looking for. I did a google search and found mad resources, too. Many of those link to academic resources or books though, so I have a final question for you: Is there a specific, official website for the STL that has a quick reference for available templates (with functions, parameters, return vals, etc)? I have the third edition of Stroustrup''s "The C++ Programming Language"; upon thumbing through, I see info scattered through there, but I am looking for the actual framework in a compact (preferably HTML) form. Thank you.

BTW, I am using Microsoft Visual Studio 6.0 Proffesional (I am not sure if this is pertinent--is the STL in the language spec or is it compiler specific?). Thanx again.

--OctDev

Share this post


Link to post
Share on other sites
All modern C++ compilers on all platforms come with the STL, being a part of the standard C++ libraries. Visual Studio 6 certainly does. Just like with any other standard library, to use it, you just include the header. For example, to use an STL vector, you do this:

#include <vector> // access to std::vector

Now you can use vectors like so:

std::vector myVector;

If you use the ''using namespace std;'' command somewhere after including the headers and before you use the type, you won''t need the std:: prefix.

Since the STL is standard, documentation on it comes with your compiler. To find Visual Studio''s documentation on the STL, simply search for ''STL'' and look for a ''Table of Contents'' page. Browse the links from there for more information. Alternatively, you can look at the documentation for SGI''s version of the STL at http://www.sgi.com/tech/stl/. Their documentation is a lot better, but be sure to look out for the few parts that are SGI-specific (ie. won''t work in MS Visual Studio).

More STL links, if you need extra assistance: here, here, and here. And numerous more besides: just search for them.

Hope that helps.

Share this post


Link to post
Share on other sites