google / benchmark

A microbenchmark support library
Apache License 2.0
8.69k stars 1.59k forks source link

[BUG] Build fails because NOMINMAX redefined from standard library #1581

Closed dushko closed 1 year ago

dushko commented 1 year ago

Describe the bug Build fails because macro "NOMINMAX" redefined in "src/internal_macros.h". NOMINMAX is first defined in library file which is included in include chain from <algorithm>.

System

To reproduce

  1. sync to commit f7547e2
  2. cmake -B build -DCMAKE_CXX_COMPILER=g++ -GNinja
  3. ninja -C build
  4. See error

Expected behavior Build finishes without errors.

Screenshots Full error message: full_error

Additional context Both these changes fix the build:

#ifndef NOMINMAX 
  #define NOMINMAX
#endif

#undef NOMINMAX
#define NOMINMAX