STL malignant or benign

Started by
24 comments, last by smr 18 years, 9 months ago
Quote:Original post by 5MinuteGaming
I'm using gcc 3.4.4 and have cygwin installed.

Then prehaps you're refering to out of date documentation? GCC 3.4.4 is a fine compiler with a fine implementation of the standard library. I had no problems following Boost's "Getting Started" installation guide with installing Boost on MinGW GCC 3.4.2, except for not realizing that boost-jam-3.1.10-1-ntx86.zip was in fact the prebuilt windows version of Boost.Jam (my brain was refusing to make the connection: NT = Windows NT = Windows).
Advertisement
You are using VC++6.

VC++6 ships with the old style pre-standardisation headers (like string.h, vector.h) rather than the standard library style headers.

It's little wonder that you couldn't get a program using the standard library to compiler on both gcc3.4.4 and VC++6, seeing as all the std classes are in different headrer and different namespaces with each compiler.

It's also no suprise that you have trouble with boost - boost is extremely template heavy - the template support in VC++6 is totally inadequate for boost.

Why use VC++6 when you already have gcc3.4.4? If you want two different compilers to test against then download the optimizing compiler the microsoft give away for free.
Quote:Original post by Nitage
You are using VC++6.


I was under the impression he was mainly trying to use GCC? VC++6 is prestandard and a piece of dung not worthy of my toilet bowl (Okay, maybe not that bad (especially considering said toilet is currently clogged with shit and I have no plunger >_<), but it's support for the standard is quite lacking in many places), so if he's mixing the two together that would indeed cause problems.

SC++L headers should only be used with the compiler they were meant for. -Mike
Quote:SC++L headers should only be used with the compiler they were meant for. -Mike


I didn't mean that he might be mixing the header files, I meant that this would not compile in VC6:
#include <vector>void foo(){    std::vector<int> v;}


and this will not compiler in gcc

#include <vector.h>void foo(){    vector<int> v;}


So the only ways to write code that will compile on both platforms are to either totally avoid the standard library, or use a 3rd party implementation with VC6.

So it isn't a suprise he's been having problems and believes the std library isn't that standard.

Quote:Original post by Nitage
I didn't mean that he might be mixing the header files, I meant that this would not compile in VC6:
*** Source Snippet Removed ***


Im using VC6 at work and trust me that does compile just fine, the problems with VC6 are invalid scoping lacking partial template specializations and that is sometimes get very creative (or lacking in that department) when trying to handle complex templates. But most of the vanilla code encountred will compile just fine or with minor tweaks.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Quote:Original post by DigitalDelusion
Quote:Original post by Nitage
I didn't mean that he might be mixing the header files, I meant that this would not compile in VC6:
*** Source Snippet Removed ***


Im using VC6 at work and trust me that does compile just fine, the problems with VC6 are invalid scoping lacking partial template specializations and that is sometimes get very creative (or lacking in that department) when trying to handle complex templates. But most of the vanilla code encountred will compile just fine or with minor tweaks.


I was under the impression that VC6 did not ship with the standard headers, only the old style ones. My mistake.
Well, Actually my dilemma is quiet mixed. I am using VC++6 for a project that ties in Ogre and CEGUI and have been unsuccessfull in getting it to compile because of missing headers <hash_set> specifically and then <ext/hashtable> when I am able to get to the <hash_set> library header then there are a ton of errors probably as DigitalDelusion pointed out VC6 is lacking in support for template classes which is no suprise to me since I've attempted to make plenty of template classes in VC6 and have always run into problems.

It may be the case that I am trying to use the library header made for GCC with VC6 but my dilemma is that now I need to know where I can get the most recent STL library or the STL library that Ogre uses so there is no compatibility issues with either the compiler and code.

So in short is there a version of the extended STL or STL port that will work with VC6. I noticed in the install for STLport which I downloaded it mentioned something about setting it up for your compiler. I'm still a little lost as to why in God's name you would have to compile a standard library just to use the library unless they mean create the precompiled libraries using your compiler and in that case hmmmm their really lazy and wasting my time.

Please, someone enlighten me I'm so lost its pathetic.
start with fetching a better compiler you can get MSVC2005 beta 2 for free from Microsoft that should solve some of the problems right out of the box.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Yeah! I already thought of that one. I'm one step ahead of you except the shipping company is not I made the mistake of ordering the CD. But it was free except for shipping which wasn't that bad hopefully I'll have that soon.

I've used Visual Studio with .NET before but didn't really like it but I'll get used to it.

Also, does anyone know how I can configure the STLport with my compiler like I stated before do I have to compile the source to a library file, or run some script or something.
Quote:Original post by 5MinuteGaming
and have been unsuccessfull in getting it to compile because of missing headers <hash_set> specifically and then <ext/hashtable> when I am able to get to the <hash_set> library header then there are a ton of errors


The problem is that the hash_set class is not part of the C++ standard library. When the standard committee decided what should be included, the proposal for hash tables came in too late. It therefore was not included in the standard. Vendors did include hash table implementations of their own and as you have noticed, the Dinkumware implementation (included in VC6) differs from the SGI implementation (included in GCC). One of the main differences in interface is how the hash function is specified.

If you really want to use that hash_set class, you'll probably have to write a wrapper yourself to provide a unified interface and either use conditional compilation or your build process (preferably) to select one implementation or another.

Quote:So in short is there a version of the extended STL or STL port that will work with VC6. I noticed in the install for STLport which I downloaded it mentioned something about setting it up for your compiler.


STLport should work with VC6.

Quote:I'm still a little lost as to why in God's name you would have to compile a standard library just to use the library unless they mean create the precompiled libraries using your compiler and in that case hmmmm their really lazy and wasting my time.


The only part of STLport you need to compile is the IOStream library (you know, std::cin, std::cout ...) and even that is optional: if you don't it'll just use the IOStream library that ships with your C++ platform (the reason why you can compile it is because you generally only care about the char and wchar_t specializations of the class templates). The rest of the library is implemented as header files (it's all template code so there isn't much choice). As for them being lazy, do you really think they should provide a binary library build for each and every combination of compilers, architectures, etc? I think not. The Boost C++ library is in precisely the same situation, for all that they do provide you with makefiles supporting a number of compilers.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement