Solved

Conflicting names

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

759 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