Bugs item #3588369, was opened at 2012-11-18 13:11
Message generated for change (Comment added) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3588369&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Marcello Pietrobon (marcello-ptr) >Assigned to: Luigi Ballabio (lballabio) Summary: (with fix) vs2010 warning C4005: 'M_PI' : macro redefinition Initial Comment: vs2010 with STLPort.5.2.1 and Boost.1_52 XP SP3 I get the annoying warnings: 1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h(632): warning C4005: 'M_PI' : macro redefinition 1> D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/mathconstants.hpp(54) : see previous definition of 'M_PI' 1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h(639): warning C4005: 'M_SQRT1_2' : macro redefinition 1> D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/mathconstants.hpp(102) : see previous definition of 'M_SQRT1_2' while compiling ql/utilities/dataparser.cpp I didn't go to find out if the problem appears without STLPort too, In syntesis this is what appears as output build with the option 'show includes': 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/utilities/dataparsers.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/time/date.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/time/period.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/time/frequency.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/qldefines.hpp 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/config.hpp 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/config/select_stdlib_config.hpp 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\cstddef 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/_prolog.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/debug/_debug.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/_threads.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/_cstdlib.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/_cmath.h 1> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/cmath 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\math.h 1> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h // ** defined here ** 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/utilities/null.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/time/period.hpp 1> Note: including file: D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/errors.hpp 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/lexical_cast.hpp ... 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/math/special_functions/sign.hpp ... 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/math/special_functions/math_fwd.hpp ... 1> Note: including file: D:\Projs\Libraries\Bsd\Boost\Boost-Active\boost/math/policies/policy.hpp ... 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\math.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/_cprolog.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/config/_prolog.h 1> Note: including file: d:\Projs\Libraries\BSD\STLPort\STLport-Active\stlport\stl/config/_warnings_off.h 1> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h 1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h(643): warning C4005: 'M_SQRT1_2' : macro redefinition 1> D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql/mathconstants.hpp(103) : see previous definition of 'M_SQRT1_2' Analysis: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h is included twice, but the first time M_PI doesnt get defined then D:\Projs\Libraries\Public\QuantLib\QuantLib-Active\ql\mathconstants.hpp is included and then again (the 2nd time) C:\Program Files\Microsoft Visual Studio 10.0\VC\include\../include/math.h but this time with the macro _USE_MATH_DEFINES defined (see note in math.h) and here we get the warning message. Solution: In ql\utilities\dataparsers.cpp before #include <ql/utilities/dataparsers.hpp> add the following lines: #ifdef _MSC_VER // MP- # define _USE_MATH_DEFINES //# include <math.h> // not necessary #endif // MP- To #include <math.h> is not necessary because dataparsers.hpp indirectly already includes it before ql\mathconstants.hpp gets included. ---------------------------------------------------------------------- >Comment By: Luigi Ballabio (lballabio) Date: 2012-12-03 03:40 Message: Thanks. I've applied your patch in qldefines.hpp so that it applies globally (just in case the same problem surfaces in another file). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3588369&group_id=12740 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |