can not use lib

mc 5,326 Reputation points
2025-05-04T12:53:24.2233333+00:00

User's image

I want to use lib

but there is errors:

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,932 questions
{count} votes

Accepted answer
  1. Darran Rowe 1,716 Reputation points
    2025-05-04T16:48:23.9966667+00:00

    The main reason why I previously wrote:

    First of all, please provide a full example of what you are trying to do. Previously included headers can affect following headers in C/C++.

    is because of what caused this.

    enter image description here

    Including Windows.h before manifold/manifold.h causes this. Having a full code example would have made this much easier to notice.

    The code on github shows that at line 1689 is where the definition of the min template function is. This is important because Windows.h, or specifically minwindef.h defines the following:

    //minwindef.h line 190 in the 10.0.26100.0 SDK.
    #ifndef NOMINMAX
    
    #ifndef max
    #define max(a,b)            (((a) > (b)) ? (a) : (b))
    #endif
    
    #ifndef min
    #define min(a,b)            (((a) < (b)) ? (a) : (b))
    #endif
    
    #endif  /* NOMINMAX */
    

    So the inclusion of Windows.h is causing errors in manifold/manifold.h. Defining NOMINMAX before including Windows.h will fix this.

    #define NOMINMAX
    #include <Windows.h>
    #include <manifold/manifold.h>
    
    int wmain()
    {
    	return 0;
    }
    

    enter image description here


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.