Errors compiling FastNoise for Due

Hi,

I'm trying to use the FastNoise library with the Due, however, I get the following errors, when I try to complie.

  • error: 'abs' was not declared in this scope
  • error: 'mt19937' is not a member of 'std'
  • error: 'uniform_int_distribution' is not a member of 'std'

What should I do in order to use the library?

Thanks!

Full error message:

Build options changed, rebuilding all
..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp: In function 'int FastAbs(int)':

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:183:41: error: 'abs' was not declared in this scope

 static int FastAbs(int i) { return abs(i); }

                                         ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp: In member function 'void FastNoise::SetSeed(int)':

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:198:2: error: 'mt19937' is not a member of 'std'

  std::mt19937 gen(seed);

  ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:198:15: error: expected ';' before 'gen'

  std::mt19937 gen(seed);

               ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:205:3: error: 'uniform_int_distribution' is not a member of 'std'

   std::uniform_int_distribution<> dis(0, 256 - j);

   ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:205:33: error: expected primary-expression before '>' token

   std::uniform_int_distribution<> dis(0, 256 - j);

                                 ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:205:49: error: 'dis' was not declared in this scope

   std::uniform_int_distribution<> dis(0, 256 - j);

                                                 ^

..\Documents\Arduino\libraries\FastNoise-0.4\FastNoise.cpp:206:15: error: 'gen' was not declared in this scope

   int k = dis(gen) + j;

               ^

exit status 1
Error compiling for board Arduino Due (Programming Port).

Do you think that it might help if you posted the code that causes the error and links to any libraries used ?

sure:

#include <FastNoise.h>

FastNoise myNoise;

void loop() {
  myNoise.GetSimplexFractal(0, 0);
}

I've added the following:

#include <cstdlib>
#include <cmath>
#include <random>

which helped, however I'm still struggling with printf:

In file included from \appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\random:39:0,

                 from \a.ino:6:

\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\cstdio:122:11: error: '::printf' has not been declared

   using ::printf;

           ^

If I try to solve the issue in cstdio:122:11: by commenting out the #undef printf, which I would think would 'define printf', all the previous error messages come back.

There are a couple of proposed solutions on the arduino playgrounds and at the forum here, however none of these seem to work. Do you have any idea how should I solve this? It seems like there is fundamental knowledge missing for me about the libraries and inclusions, but someone with more experience could help me here. Thanks in advance!