warning C4003: not enough actual parameters for macro 'min'

This is a discussion on warning C4003: not enough actual parameters for macro 'min' within the C++ Programming forums, part of the General Programming Boards category; E:\PROGRAMMING\CPP\MLIBRARY\MValue.h(56) : warning C4003: not enough actual parameters for macro 'min'
This is the error I get at the spot ...

warning C4003: not enough actual parameters for macro 'min'

It seems like another min() function/macro exists. After some research on this forum I found that this could be solved by undefining min before including <limits>. However that solution is really ugly. Why does this collision occur anyway? I'm using the full std:: notation, and the whole point of using namespaces is to avoid these collisions, right?

Re: warning C4003: not enough actual parameters for macro 'min'

Originally posted by Magos This is the error I get at the spot I'm using:

Code:

InitialMin = std::numeric_limits<int>::min();

It seems like another min() function/macro exists. After some research on this forum I found that this could be solved by undefining min before including <limits>. However that solution is really ugly. Why does this collision occur anyway? I'm using the full std:: notation, and the whole point of using namespaces is to avoid these collisions, right?

I think it's because macros are expanded by the preprocessor before any of the C++ name resolution takes place. That's why they are discouraged over using inline functions in C++.

I had this problem with a version of Codewarrior whenever I used windows.h and certian parts of the stl. The #undef solution worked ok for me