Porting the FastNoise c++ library to Due I'm trying to use the FastNoise library with a Due, however, I get something like 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'

so I added the following:

#include &lt;cstdlib&gt;
#include &lt;cmath&gt;
#include &lt;random&gt;


which solved most of the problems, however it still says printf hasn't been declared. So I tried to edit cstdio to comment out the #undef printf, but it just brought back the full list of error messages, so that's not the solution. I googled some solutions but none of these seem to work. Do you have any suggestions I should try?

I'm not trying to use printf, just want to use the library.

Thanks for any help.
The FastNoise library compiles as it is for the Arduino MKR and Arduino Zero, but there is a "not cool" issue for the Due: https://github.com/arduino/ArduinoCore-samd/issues/308

A issue with assert can easily be solved, but the #include &lt;algorithm&gt; and #include &lt;random&gt; are somehow linked to a printf function.
I thought it was very hard, but then @Juraj wrote in his answer about the simple solution to comment out the #undef printf line.

In the file cstdio is a list of about fourty #undef lines. Only the printf requires to be commented out.  

// #undef printf


The file is located in the hidden "Arduino15" folder in the build environment for the Due: Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\cstdio

Then it will also compile for the Arduino Due (even without removing the assert). There are many warnings.

I was able to run it on a SAMD21 processor and it produces random numbers. However, I am not sure that those numbers are correct. I don't know if the many compiler warnings can be ignored.

#include &lt;FastNoise.h&gt;

FastNoise myNoise; // Create a FastNoise object

float heightMap[32][32]; // 2D heightmap to create terrain

void setup() {
  SerialUSB.begin(9600);
  SerialUSB.println("FastNoise");
  delay(1000);

  myNoise.SetNoiseType(FastNoise::SimplexFractal); // Set the desired noise type

  for(int x=0; x&lt;32; x++) {
    for(int y=0; y&lt;32; y++) {
      heightMap[x][y] = myNoise.GetNoise(x,y);
      SerialUSB.println(heightMap[x][y]);
    }
  }
}

void loop() {
}


Do you know the XY Problem? You did not explain the reason for trying to make that library run on a Arduino Due. Perhaps there is an other way for what you want to achieve.

The Arduino Due was a major update for the Arduino boards, but nowadays some say to avoid the Arduino Due because it has issues (hardware and software).



I have updated my answer with help of the answer from @Juray.