Index: cpp/frams/model/similarity/EMD/emd.c
===================================================================
--- cpp/frams/model/similarity/EMD/emd.c	(revision 1125)
+++ cpp/frams/model/similarity/EMD/emd.c	(revision 1130)
@@ -19,4 +19,5 @@
 #include <stdlib.h>
 #include <math.h>
+#include <algorithm>
 
 #include "emd.h"
@@ -100,5 +101,5 @@
 {
   int itr;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double totalCost;
   float w;
@@ -211,5 +212,5 @@
 {
   int i, j;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double sSum, dSum, diff;
   feature_t *P1, *P2;
@@ -474,5 +475,5 @@
 {
     int i, j, k;
-    int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+    int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     double xMin;
     int steps;
@@ -555,5 +556,5 @@
 {
   int i, steps;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   node2_t **CurX, *NewX;
   char *IsUsed=new char[2*max_n]; 
@@ -652,5 +653,5 @@
 {
   int i, j, found, minI, minJ;
-  int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
+  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
   double deltaMin, oldVal, diff;
   double** Delta = new double*[_n1];
Index: cpp/frams/model/similarity/measure-distribution.cpp
===================================================================
--- cpp/frams/model/similarity/measure-distribution.cpp	(revision 1125)
+++ cpp/frams/model/similarity/measure-distribution.cpp	(revision 1130)
@@ -79,5 +79,5 @@
 	//int size = sampled.getPartCount();
 	//if (size < (int) sqrt((double) std::numeric_limits<int>::max())) //prevent exceeding int limits
-	//	samples_taken = min(samples_num, size*size);
+	//	samples_taken = std::min(samples_num, size*size);
 
 	rndgen.seed(55); //For determinism. Otherwise the descriptors (that choose samples pseudo-randomly) for the same Model can yield different values and so the dissimilarity between the object and its copy will not be 0.
