chromiumembedded / cef

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

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

Closed copilot0058 closed 1 week ago

copilot0058 commented 1 week 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 1 week ago

What OS, CEF version and compiler version?

vitaltree3 commented 1 week 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 1 week ago

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

copilot0058 commented 3 days ago

Great