Solved

Conflicting names

Posted on 2000-05-14
2
174 Views
Last Modified: 2010-04-02
I am having problems when trying to use macros having the same name as that of functions. Actually <windows.h> includes <windef.h>.  The min(a,b) and max(a,b) macros are defined in <windef.h>. On the other hand min() & max() functions are present in <valarray> an STL class  . So whenever this two files are getting included at the same time it is giving  an compilation error.

For example the following code will give compilation error

#include <windows.h>
#include <valarray>

int main(int argc, char* argv[])
{
 return 0;
}

Can any of you experts out there suggest a practical workaround / solution to this problem.
0
Comment
Question by:lshankar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
Talmash earned 100 total points
ID: 2809424
hi ,

you should turn to min/max function as sons of windows/valarry .

that mean , you should declare them as a built-in functions with appropriate authority
(private/public etc...) , in some C-books it is called as internal-methods of a structure/class
..

this will be more helpfully if you'll one day add <stdlib.h> which if I'm not wrong already
includes min / max regular functions of its own .

Talmash
0
 

Author Comment

by:lshankar
ID: 2810243
Could you elaborate with some code examples
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question