Topic: VC5 and STL question


Author: AllanW@my-dejanews.com
Date: 1998/10/11
Raw View
In article <dDoS1.5257$Ge.14854362@ptah.visi.com>,
  "Thomas T. Veldhouse" <veldy@visi.com> wrote:
> >> How can you wrap the SGI version of STL into its own namespace?  Do I
> have
> >> to go and hack all the template code? Or is there another simple method I
> >> have simply overlooked.

In message <6vgrf4$53j$1@nnrp1.dejanews.com>, I wrote:
> >If you want to remove the normal namespace std { } wrap, you
> >can simply #define __STL_NO_NAMESPACES before including any
> >SGI headers.
>
> >If you really want to wrap all the SGI templates in some other
> >namespace, such as namespace sgi { }, you should ask yourself
> >what possible purpose this solves... but if you're beyond that,
> >and certain you want to do it, then edit the configuration
> >file. For version 3.11, this is named stl_config.h. There's
> >about 4 places that define macros which use this name. For
> >other versions it might be the same filename or some other
> >name, I'm not sure.

In article <3f5T1.265$525.775775@ptah.visi.com>,
  "Thomas T. Veldhouse" <veldy@visi.com> wrote:

> When I used 3.11 with VC++ 5, I found that the templates were not wrapped in
> a namespace at all.

Sorry; I should have tried it before posting my response.

Edit #stl_config.h. At around line 200, change
    #   if _MSC_VER >= 1200
    #     define __STL_PARTIAL_SPECIALIZATION_SYNTAX
    #     define __STL_HAS_NAMESPACES
    #     define __STL_NO_NAMESPACES
    #   endif
to
    #   if _MSC_VER >= 1100 // 1200
    #     define __STL_PARTIAL_SPECIALIZATION_SYNTAX
    #     define __STL_HAS_NAMESPACES
    //#   define __STL_NO_NAMESPACES // Why is this here?
    #   endif
This will wrap all the SGI STL routines in namespace std.
If you want to wrap it in some other namespace, such as "sgi",
then you should also change four occurances of "std" to that
other name in lines (about) 279 to 285.

--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Wojtek Surowka <WojtekS@aldec.katowice.pl>
Date: 1998/10/06
Raw View
Bjorn Hamre <hamre@tor.ber.hs.nki.no> wrote in message
361346BC.6D242DCE@tor.ber.hs.nki.no...
>I downloaded SGI's STL and
>* copied the header files to a separate directory (e:\include\SGISTL)
>* added 'e:\include' to the search path for header files in the
>  prosject settings.
>* used #include <SGISTL\list> to include the header file for list.

Using SGI STL instead of VC STL is a great idea. But you must use it
_instead_, not _besides_. Try adding the e:\include\SGISTL directory to
include paths in Tools/Options/Directory BEFORE standard path to VC\include,
and do not use
#include <SGISTL\list>
but
#include <list>
This will work.

WS
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: bill@jcc.com (Bill Wernet)
Date: 1998/10/07
Raw View
I have been trying to use the SGI STL with VC++ 6.0.

The program I am compiling contains a line:

vector<int> aVector;

I get the following error when trying to compile the code.

E:\Projects\Common\sgistl\type_traits.h(158) : error C2011: '__type_traits<int>'
: 'struct' type redefinition
E:\Projects\Common\sgistl\type_traits.h(341) : error C2011: '_Is_integer<int>' :
'struct' type redefinition

What am I doing wrong?

Bill



Wojtek Surowka <WojtekS@aldec.katowice.pl> wrote:

>Bjorn Hamre <hamre@tor.ber.hs.nki.no> wrote in message
>361346BC.6D242DCE@tor.ber.hs.nki.no...
>>I downloaded SGI's STL and
>>* copied the header files to a separate directory (e:\include\SGISTL)
>>* added 'e:\include' to the search path for header files in the
>>  prosject settings.
>>* used #include <SGISTL\list> to include the header file for list.
>
>Using SGI STL instead of VC STL is a great idea. But you must use it
>_instead_, not _besides_. Try adding the e:\include\SGISTL directory to
>include paths in Tools/Options/Directory BEFORE standard path to VC\include,
>and do not use
>#include <SGISTL\list>
>but
>#include <list>
>This will work.

______________________________________________________

Bill Wernet
Consultant
JCC Consulting, Inc.
bill@jcc.com
614-587-0157
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Thomas T. Veldhouse" <veldy@visi.com>
Date: 1998/10/07
Raw View
How can you wrap the SGI version of STL into its own namespace?  Do I have
to go and hack all the template code? Or is there another simple method I
have simply overlooked.

Tom Veldhouse
veldy@visi.com
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Wojtek Surowka" <WojtekS@aldec.katowice.pl>
Date: 1998/10/07
Raw View
Thomas T. Veldhouse <veldy@visi.com> wrote in message
dDoS1.5257$Ge.14854362@ptah.visi.com...
>How can you wrap the SGI version of STL into its own namespace?  Do I have
>to go and hack all the template code? Or is there another simple method I
>have simply overlooked.

I don't know how can I wrap SGI STL into its own namespace. I use it instead
of STL bundled with VC++, so it is in std namespace.

WS




[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: AllanW@my-dejanews.com
Date: 1998/10/08
Raw View
In article <dDoS1.5257$Ge.14854362@ptah.visi.com>,
  "Thomas T. Veldhouse" <veldy@visi.com> wrote:
> How can you wrap the SGI version of STL into its own namespace?  Do I have
> to go and hack all the template code? Or is there another simple method I
> have simply overlooked.

If you want to remove the normal namespace std { } wrap, you
can simply #define __STL_NO_NAMESPACES before including any
SGI headers.

If you really want to wrap all the SGI templates in some other
namespace, such as namespace sgi { }, you should ask yourself
what possible purpose this solves... but if you're beyond that,
and certain you want to do it, then edit the configuration
file. For version 3.11, this is named stl_config.h. There's
about 4 places that define macros which use this name. For
other versions it might be the same filename or some other
name, I'm not sure.

--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Thomas T. Veldhouse" <veldy@visi.com>
Date: 1998/10/09
Raw View
When I used 3.11 with VC++ 5, I found that the templates were not wrapped in
a namespace at all.


AllanW@my-dejanews.com wrote in message <6vgrf4$53j$1@nnrp1.dejanews.com>...
>In article <dDoS1.5257$Ge.14854362@ptah.visi.com>,
>  "Thomas T. Veldhouse" <veldy@visi.com> wrote:
>> How can you wrap the SGI version of STL into its own namespace?  Do I
have
>> to go and hack all the template code? Or is there another simple method I
>> have simply overlooked.

>If you want to remove the normal namespace std { } wrap, you
>can simply #define __STL_NO_NAMESPACES before including any
>SGI headers.

>If you really want to wrap all the SGI templates in some other
>namespace, such as namespace sgi { }, you should ask yourself
>what possible purpose this solves... but if you're beyond that,
>and certain you want to do it, then edit the configuration
>file. For version 3.11, this is named stl_config.h. There's
>about 4 places that define macros which use this name. For
>other versions it might be the same filename or some other
>name, I'm not sure.





[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "Thomas T. Veldhouse" <veldy@visi.com>
Date: 1998/10/09
Raw View
Bill Wernet wrote in message <361a822f.164993057@news-read.fnsi.net>...
>I have been trying to use the SGI STL with VC++ 6.0.
>
>The program I am compiling contains a line:
>
>vector<int> aVector;
>
>I get the following error when trying to compile the code.
>
>E:\Projects\Common\sgistl\type_traits.h(158) : error C2011:
'__type_traits<int>'
>: 'struct' type redefinition
>E:\Projects\Common\sgistl\type_traits.h(341) : error C2011:
'_Is_integer<int>' :
>'struct' type redefinition
>
>What am I doing wrong?
>

I had this problem too when you use the standard <iostream> from Visual C++
standard library.  It does not mix well with SGI STL.  You should probably
try <iostream.h>  I think that got around the problem for me.

Tom Veldhouse
veldy@visi.com
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Thomas T. Veldhouse" <veldy@visi.com>
Date: 1998/10/02
Raw View
Do you have an example of your code.  I haven't seen a problem with this
before.

Bjorn Hamre wrote in message <361346BC.6D242DCE@tor.ber.hs.nki.no>...
>
>I have Visual C++ 5.0 (prfessional edition) and are keen
>on learning to use the new standard template library (STL).
>However, I have some difficulties with "features" that
>are not supported by VC5, e.g. calling a list's sort
>function with a compare function as argument. This works
>fine using g++ on a Linux box.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: "Jon Pearson" <pearson@ccdc.cam.ac.uk>
Date: 1998/10/02
Raw View
Bjorn Hamre wrote in message <361346BC.6D242DCE@tor.ber.hs.nki.no>...
> ...
>The question is: Is there an implementation of STL freely
>available that I can download and use with VC5?


I think the problems with VC's STL are due to the limitations of the VC++
compiler.  A different STL won't help you.  A different compiler might.

---------------------------------------------------
Jon Pearson
Cambridge Crystallographic Data Centre
12 Union Road
Cambridge CB2 1EZ
UK
pearson@ccdc.cam.ac.uk





[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Bjorn Hamre <hamre@tor.ber.hs.nki.no>
Date: 1998/10/01
Raw View
I have Visual C++ 5.0 (prfessional edition) and are keen
on learning to use the new standard template library (STL).
However, I have some difficulties with "features" that
are not supported by VC5, e.g. calling a list's sort
function with a compare function as argument. This works
fine using g++ on a Linux box.

I can not afford to upgrade to VC6, and I do not want to
install the Linux operating system at home. I know I can
install djgpp on Windows 95 but I so much like the programming
environment that VC5 offers.

The question is: Is there an implementation of STL freely
available that I can download and use with VC5?

I downloaded SGI's STL and
* copied the header files to a separate directory (e:\include\SGISTL)
* added 'e:\include' to the search path for header files in the
  prosject settings.
* used #include <SGISTL\list> to include the header file for list.

This didn't work. Am I doing something wrong? Is there some
compiler options or directives I should set/remove? Is there
another implementation of STL I should use that works with VC5?
How do I prevent the SGI STL files from beeing mixed with the possibly
incompatible VC5 header files?

Have anybody any experience with this that they would
like to share with me?

Thanks.
Bjoern

e-mail:
hamre@ii.uib.no


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: AllanW@my-dejanews.com
Date: 1998/10/01
Raw View
In article <361346BC.6D242DCE@tor.ber.hs.nki.no>,
  Bjorn Hamre <hamre@tor.ber.hs.nki.no> wrote:
> I downloaded SGI's STL and
> * copied the header files to a separate directory (e:\include\SGISTL)
> * added 'e:\include' to the search path for header files in the
>   prosject settings.
> * used #include <SGISTL\list> to include the header file for list.
>
> This didn't work. Am I doing something wrong?

You didn't say what "didn't work" means. But, I believe that STI's
#include files need to #include each other, and they do not use
SGISTL\ before the include-file names.

Try changing your search path to use e:\include\SGISTL and use
#include <list> in the header file.

--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]