chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.36k stars 467 forks source link

std::min expected an identifierC/C++(40) #3827

Closed copilot0058 closed 2 days ago

copilot0058 commented 4 days ago

Describe the bug A clear and concise description of what the bug is.

https://github.com/chromiumembedded/cef-project/blob/c3104bd6ab3fce9551edd4d74ed575605f37f4a0/examples/shared/resource_util.cc#L19

  const size_t pos = std::min(url.find('?'), url.find('#'));

To Reproduce

expected an identifierC/C++(40)
#define min(a,b) (((a) < (b)) ? (a) : (b))
Expands to:

(((url.find('?')) < (url.find('#'))) ? (url.find('?')) : (url.find('#')))
magreenblatt commented 4 days ago

What OS, CEF version and compiler version?

vitaltree3 commented 3 days ago

Describe the bug A clear and concise description of what the bug is.

https://github.com/chromiumembedded/cef-project/blob/c3104bd6ab3fce9551edd4d74ed575605f37f4a0/examples/shared/resource_util.cc#L19

  const size_t pos = std::min(url.find('?'), url.find('#'));

To Reproduce

expected an identifierC/C++(40)
#define min(a,b) (((a) < (b)) ? (a) : (b))
Expands to:

(((url.find('?')) < (url.find('#'))) ? (url.find('?')) : (url.find('#')))

Add "NOMINMAX" to PreprocessorDefinitions in your project setting , then your compile error will disappear.

9001

magreenblatt commented 3 days ago

NOMINMAX is also already defined in the provided CMake Windows configuration.