std::min and std::max errors due to some macro-function named "max()" and "min()"

28 views
Skip to first unread message

Gilles Foucault

unread,
Mar 11, 2026, 10:59:19 AMMar 11
to golden-cheetah-developers
Hello

I managed to compile Golden Cheetah for the first time yesterday.
I had to fix many compilation errors like these ones described in stackoverflow :
// Source - https://stackoverflow.com/q/13416418
// Posted by NaturalDemon, modified by community. See post 'Timeline' for change history
// Retrieved 2026-03-11, License - CC BY-SA 3.0

error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'

I applied the fix be encompassing std::min and std::max calls into parentheses :
(std::min)(x, y);
both in GC sources and Qt sources (mainly in headers).

Should I commit these fixes to github?

Example :
diff --git a/src/Charts/PowerHist.h b/src/Charts/PowerHist.h
index 70c9c4b64..b965c09c9 100644
--- a/src/Charts/PowerHist.h
+++ b/src/Charts/PowerHist.h
@@ -218,7 +218,7 @@ class PowerHist : public QwtPlot
         bool shadePaceZones() const; // check if zone shading is both wanted and possible

         // Warning: the chart crashes when precision > 2
-        static int validatePrecision(int precision) { return std::min(precision, 2); }
+        static int validatePrecision(int precision) { return (std::min)(precision, 2); }

         // plot settings
         RideItem *rideItem;

diff --git a/src/Train/MultiRegressionizer.h b/src/Train/MultiRegressionizer.h
index a115216e5..0e9e93a8c 100644
--- a/src/Train/MultiRegressionizer.h
+++ b/src/Train/MultiRegressionizer.h
@@ -727,8 +727,8 @@ public:
                     if (bestStdDev > epsilon)
                         isNewBest = true;
                     else {
-                        size_t bestMax = std::max(bestNum.size(), bestDen.size());
-                        size_t curMax = std::max(m_num.size(), m_den.size());
+                        size_t bestMax = (std::max)(bestNum.size(), bestDen.size());
+                        size_t curMax = (std::max)(m_num.size(), m_den.size());

Best regards

Gilles

Ale Martinez

unread,
Mar 11, 2026, 11:37:39 AMMar 11
to golden-cheetah-developers
El miércoles, 11 de marzo de 2026 a la(s) 11:59:19 a.m. UTC-3, Gilles Foucault escribió:
Hello

I managed to compile Golden Cheetah for the first time yesterday.
I had to fix many compilation errors like these ones described in stackoverflow :
// Source - https://stackoverflow.com/q/13416418
// Posted by NaturalDemon, modified by community. See post 'Timeline' for change history
// Retrieved 2026-03-11, License - CC BY-SA 3.0

error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'

I applied the fix be encompassing std::min and std::max calls into parentheses :
(std::min)(x, y);
both in GC sources and Qt sources (mainly in headers).

Should I commit these fixes to github?

Gilles Foucault

unread,
Mar 11, 2026, 11:41:29 AMMar 11
to golden-cheetah-developers
Thanks.

This windows-specific setting should be written in 

If I knew that, I would have saved my time...

Ale Martinez

unread,
Mar 11, 2026, 11:54:57 AMMar 11
to golden-cheetah-developers
El miércoles, 11 de marzo de 2026 a la(s) 12:41:29 p.m. UTC-3, Gilles Foucault escribió:
Thanks.

This windows-specific setting should be written in 

INSTALL-WIN32 is way outdated, I updated Linux and macOS which are more frequently used but Windows is a pending task, as a say goes here: tenemos más caciques que indios...
 
If I knew that, I would have saved my time...

It is expected you read gcconfig.pri.in if you are building from source, besides you can look at appveyor/windows scripts to see how our builds are configured.
Reply all
Reply to author
Forward
0 new messages