Solved

Conflicting names

Posted on 2000-05-14
2
169 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now