[GiNaC-devel] Patches for compilation with MSVC

Jan Rheinländer jrheinlaender at gmx.de
Mon May 25 14:32:02 CEST 2015


Hi,

here are some simple patches to allow the current version (from git) of
GiNaC to be compiled with MS Visual C++:

1. Fix problem with min() and max() macros in MSVC:

--- a/ginac/compiler.h
+++ b/ginac/compiler.h
@@ -34,6 +34,8 @@
 #ifdef _MSC_VER
 #define __func__ __FUNCTION__
 #define __alignof__ __alignof
+#define NOMINMAX
+#include <algorithm>
 #endif
 
 #endif // ndef GINAC_COMPILER_DEP_H

--- a/check/exam_cra.cpp
+++ b/check/exam_cra.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "polynomial/cra_garner.h"
+#include "../ginac/compiler.h"
 
 #include <cln/integer.h>
 #include <cln/integer_io.h>

2. Fix ambiguous overload of log() (MSVC is more exact here than gcc):

--- a/check/exam_inifcns.cpp
+++ b/check/exam_inifcns.cpp
@@ -312,7 +312,7 @@ static unsigned inifcns_consist_log()
 
        // a bit more complicated
        ex e1 =
log(-7*p*pow(q,3)*a*pow(b,2)*z*w).expand(expand_options::expand_transcendental);
-       ex e2 = log(7)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));
+       ex e2 = log(7.0)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));
        if (!e1.is_equal(e2))
                ++result;





More information about the GiNaC-devel mailing list