Thread overview
map in a namespace
May 11, 2002
Dimitri Kaparis
May 11, 2002
Walter
May 12, 2002
Dimitri Kaparis
May 11, 2002
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
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
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 12, 2002
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.