samindaa / RLLib

C++ Template Library to Predict, Control, Learn Behaviors, and Represent Learnable Knowledge using On/Off Policy Reinforcement Learning
http://web.cs.miami.edu/home/saminda/rllib.html
195 stars 50 forks source link

'M_PI' was not declared #10

Open alexv-ds opened 7 years ago

alexv-ds commented 7 years ago

OS: Windows 7 Compiler: Mingw32

d:\RLLib-master>mingw32-make
[  2%] Building CXX object CMakeFiles/RLLib.dir/test/AcrobotTest.cpp.obj
D:\RLLib-master\test\AcrobotTest.cpp:1:0: warning: -fPIC ignored for target (all
 code is position independent)
 /*
 ^
In file included from D:/RLLib-master/include/RL.h:31:0,
                 from D:\RLLib-master\test\Test.h:43,
                 from D:\RLLib-master\test\AcrobotTest.h:11,
                 from D:\RLLib-master\test\AcrobotTest.cpp:8:
D:/RLLib-master/include/Mathema.h: In member function 'T RLLib::Random<T>::gauss
ianProbability(const T&, const T&, const T&) const':
D:/RLLib-master/include/Mathema.h:212:68: error: 'M_PI' was not declared in this
 scope
         return exp(-0.5f * pow((x - m) / s, 2)) / (s * sqrt(2.0f * M_PI));
                                                                    ^
travek commented 7 years ago

@sasichkamega

I had the same issue. I find definition of M_PI in Geometry file in util\Eigen.

Define M_PI like the following

ifndef M_PI

define M_PI 3.14159265358979323846

endif

in the correct place in your project. Should work fne.