Fog Creek Software
g
Discussion Board




How to Declare a CMap in VC++?

All,

Can anyone give me an example of declaring a CMap in VC++?

The following declaration will not compile:
CMap<int, int*, int, int*> myMap;

I get two errors:
C2065: CMap undeclared identifier
C2062: type int unexpected.

I have copied the collections sample and compile it, but I still am unable to determine what I am doing wrong. 

Thanks!

Andrew Scott
Friday, May 7, 2004

#include <map>

std::map<int, int> myMap;

Share and enjoy. :)

Brad Wilson (dotnetguy.techieswithcats.com)
Friday, May 7, 2004

Thanks for the comment!

I am using a CMap because it is supposed to be easier to serialize it when saving. 

I found that if I add:
#include <afxtempl.h> to stdafx.h
it compiles fine.

It was really that simple :)

Thanks again!

Andrew Scott
Friday, May 7, 2004

*  Recent Topics

*  Fog Creek Home