A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
As I was porting wpkg to Windows so it would compile under Microsoft IDE version 10, I ran in a problem with variables named min and max. Windows wanted to see them as the min(a,b) and max(a,b) macros.
That started happening when I included Windows.h which I needed for handling files (CreateFileA, CloseHandle, etc.).
Since these are macros, i.e. defined with #define ..., they take priority over anything in your C++ code (since that's handled with your preprocessor.)
One way to get rid of them is to undefine those macros after the #include, something like this:
#include <Windows.h> #ifdef min #undef min #endif #ifdef max #undef max #endif
However, the Windows.h header will check for the special macro named NOMINMAX and skip on defining those macros in the first place. That's a better thing to do because that way you don't have to repeat this code each time you include WIndows.h. So edit your project and add the NOMINMAX (and on the command line use -DNOMINMAX).
Source: warning C4003 and errors C2589 and C2059 on: x = std::numeric_limits<int>::max();