Vs2015--win32 Some ideas of the project configuration GdiplusTypes.h (470): Error C3861: ' min ': identifier not found

Source: Internet
Author: User

Once in a while, bored to fall into their own dug pit.

Previous Blog "Vs2015–win32 project configuration of some ideas of the algorithm Min/max and Windows Min/max macro conflict" wrote how to deal with algorithm in Std:min and windows in the conflict of Min, We used the preprocessor Nominmax.

The standard library <algorithm> defines two template functions Std::min () and Std::max () in the header.
It is commonly used to calculate the minimum and maximum values for a pair of values. Unfortunately, they are not available in Visual C + + because these function templates are not defined. The reason is that the name min and Max <windows.h> are in conflict with the traditional Min/max macro definition in. To solve this problem, Visual C + + defines two other templates with the same functionality: _cpp_min () and _cpp_max (). We can use them instead of std::min () and Std::max (). In order to disable the Min/max macro definition in Visual C + +, you can precede the <windows.h> header file with the following: Nominmax

But when it comes to GDI, another error occurs:
GdiplusTypes.h (470): Error C3861: ' min ': identifier not found

At this time I was confused, what happened?

Baidu has a lap, all is the answer of deceptive, all told me preprocessing definition Nominmax.

But how to do all is wrong, this just dawned, originally here is need min, we can't undef off.

So before referring to GDI's related header files, redefine min:

#ifndef min#define min#endif#include <GdiPlus.h>

The premise of this is that you want to solve the algorithm in Std::min and windows in the conflict, or preprocessing: Nominmax, or this:

#undef min

Vs2015--win32 Some ideas of the project configuration GdiplusTypes.h (470): Error C3861: ' min ': identifier not found

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.