working between g++ and MSVC++

Started by
6 comments, last by discman1028 18 years, 1 month ago
I'm working with hash_maps in g++ using #include<ext/hash_map> and would like to work on my code in visual studio at home. The "hash_map"s in visual studio, however, are different (both in implementation AND include-file location) from g++'s. Is there an easy way to get VC++ 2005 to compile my code from g++?
Deep Blue Wave - Brian's Dev Blog.
Advertisement
Rip out g++'s implementation, and copy it into your project. Being templated, it should all be in the headers. You might have to do some voodoo to get it to compile, but it might not be that difficult.

You could also download SGIs implementation, and convert your code to use it instead. I'll bet that'll require less work to get it to compile properly, should that prove problematic.

CM

#ifdef _WIN32
#include
#else
#include
#endif
Quote:
#ifdef _WIN32
#include
#else
#include
#endif


The only problem here is that the IMPLEMENTATION differs between the two, not just the #include path (and I'd rather not have to do #ifdefs for every single line that involves a hash_map...).

I think I'll try downloading SGI's libraries... that IS what g++ uses, right?

Thanks again
Deep Blue Wave - Brian's Dev Blog.
Quote:Original post by BTownTKD
I think I'll try downloading SGI's libraries... that IS what g++ uses, right?

I have no idea, but it'll definately give you a common interface that will probably work for both systems.

CM
Quote:Original post by BTownTKD
I think I'll try downloading SGI's libraries... that IS what g++ uses, right?


No.

The GNU standard C++ library, aka libstdc++, imported parts of SGI's STL at one point but made a lot of modifications to (a) make it conform to the standard and (b) improve performance in many ways (one of the GNU contributors was the same guy who implemented the SGI version, and he later came up with better ideas).

Most of te SGI extensions, like rope and the hash tables, are still pretty much the same but not exactly identical. You may get lucky.

If you really want portability, use the tr1 unordered containers. They're available in modern versions of GCC and I believe they're also available in later MSVC versions.

Stephen M. Webb
Professional Free Software Developer

you might have some luck with STLport.
This space for rent.
Quote:Original post by Bregma

If you really want portability, use the tr1 unordered containers.


Where can I find more info on TR1? (google didn't produce an obvious answer...)

--== discman1028 ==--

This topic is closed to new replies.

Advertisement