More STL in Visual C++ 5.0 MFC Applications 
Author Message
 More STL in Visual C++ 5.0 MFC Applications

I've just about managed to get STL headers such as <vector> and <list> to
work in MFC-based VC++ applications. Unfortunately, I have some code which
uses <valarray> and this will not compile however hard I try.

Simply including the <valarray> header in the header for my MFC document
class produces errors such as the following:

C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : warning C4003: not
enough actual parameters for macro 'min'
C:\Program Files\DevStudio\VC\INCLUDE\valarray(105) : warning C4003: not
enough actual parameters for macro 'max'
C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : error C2629: unexpected
'template-parameter-1 ('
C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : error C2238: unexpected
token(s) preceding ':'

With another three hundred or so more of the little {*filter*}s.

I would be grateful for any help on this subject.

Cheers,

Richard Cook.



Wed, 18 Apr 2001 03:00:00 GMT  
 More STL in Visual C++ 5.0 MFC Applications
Is it possible that min and max have been declared as macros prior to you
inclusion of <valarray>?  Take a look at windef.h, for example:

#ifndef NOMINMAX

#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

#endif  /* NOMINMAX */

If you don't do something like

#undef min
#undef max
#include <valarray>

this will surely cause problems.

Michael

Quote:

> I've just about managed to get STL headers such as <vector> and <list> to
> work in MFC-based VC++ applications. Unfortunately, I have some code which
> uses <valarray> and this will not compile however hard I try.

> Simply including the <valarray> header in the header for my MFC document
> class produces errors such as the following:

> C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : warning C4003: not
> enough actual parameters for macro 'min'
> C:\Program Files\DevStudio\VC\INCLUDE\valarray(105) : warning C4003: not
> enough actual parameters for macro 'max'
> C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : error C2629: unexpected
> 'template-parameter-1 ('
> C:\Program Files\DevStudio\VC\INCLUDE\valarray(99) : error C2238: unexpected
> token(s) preceding ':'

> With another three hundred or so more of the little {*filter*}s.

> I would be grateful for any help on this subject.

> Cheers,

> Richard Cook.



Fri, 20 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Converting MFC Visual C++ 2.0 application to MFC Visual C++ 5.0

2. Using both STL and MFC with Visual C++ 5.0

3. Using both STL and MFC in Visual C++ 5.0

4. Combining STL and MFC in Visual C++ 5.0

5. Using both STL and MFC with Visual C++ 5.0

6. Using both STL and MFC with Visual C++ 5.0

7. Visual Basic 5.0 vs. Visual C++ 5.0

8. Visual Basic 5.0 vs. Visual C++ 5.0

9. Visual Basic 5.0 vs. Visual C++ 5.0

10. Visual C++ 5.0 STL error

11. MS Visual C++ 5.0 or Borland C++ 5.0?

12. Do Not Install Visual C++ 5.0 Over an Installation of Visual C++ 4.x

 

 
Powered by phpBB® Forum Software