www.digitalmars.com         C & C++   DMDScript  

c++.stl - map in a namespace

reply Dimitri Kaparis <dkaparis universalstudyhelper.com> writes:
Greetings,

I have encountered the following problem:
using the stl version that is on the CD, whenever a map object is declared
within a namespace, the compiler gives two strange errors in stl_map.h
This is a short sample that exposes the problem, along with the exact compiler
output:

#include <map>

namespace MyNameSpace
{
map<int,int> M;
}

void main()
{
}


Compiler output:

sc Test.cpp -p -mn -C -WA -S -3 -a8 -c -gf -D_CONSOLE=1 -Ic:\dm\stl -oTest.obj 
Error: c:\dm\stl\stl_map.h(232): '?8' is already defined
Error: c:\dm\stl\stl_map.h(234): '?M' is already defined
Lines Processed: 5536  Errors: 2  Warnings: 0
Build failed

Is there currently any workaround for this short of keeping maps outside
namespaces?

Thanks,
Dimitri

Dimitri Kaparis,
Independent Developer
http://www.universalstudyhelper.com - software to help you study any subject.
May 11 2002
parent reply "Walter" <walter digitalmars.com> writes:
Currently, you'll need to put the map outside of a namespace. I plan to fix
this problem. -Walter

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:abimut$2eoj$1 digitaldaemon.com...
 Greetings,

 I have encountered the following problem:
 using the stl version that is on the CD, whenever a map object is declared
 within a namespace, the compiler gives two strange errors in stl_map.h
 This is a short sample that exposes the problem, along with the exact

 output:

 #include <map>

 namespace MyNameSpace
 {
 map<int,int> M;
 }

 void main()
 {
 }


 Compiler output:

 sc

 Error: c:\dm\stl\stl_map.h(232): '?8' is already defined
 Error: c:\dm\stl\stl_map.h(234): '?M' is already defined
 Lines Processed: 5536  Errors: 2  Warnings: 0
 Build failed

 Is there currently any workaround for this short of keeping maps outside
 namespaces?

 Thanks,
 Dimitri

 Dimitri Kaparis,
 Independent Developer
 http://www.universalstudyhelper.com - software to help you study any

May 11 2002
parent Dimitri Kaparis <dkaparis universalstudyhelper.com> writes:
In article <abj1tk$2obq$1 digitaldaemon.com>, Walter says...
Currently, you'll need to put the map outside of a namespace. I plan to fix
this problem. -Walter

Thanks. Also I have found another similar problem: when exception support is enabled, you can't declare string variables within a namespace. Dimitri Kaparis, Independent Developer http://www.universalstudyhelper.com - software to help you study any subject.
May 12 2002