mtytel / cursynth

GNU ncurses terminal synthesizer
http://gnu.org/software/cursynth
GNU General Public License v3.0
446 stars 64 forks source link

Rand() was not declared in this scope. #11

Closed bram-dingelstad closed 9 years ago

bram-dingelstad commented 10 years ago

I was trying to compile this (awesome) repo, but I ran into this error :

In file included from mono_panner.cpp:20:0:
wave.h: In static member function ‘static mopo::mopo_float mopo::Wave::whitenoise()’:
wave.h:245:28: error: ‘rand’ was not declared in this scope
         return (2.0 * rand()) / RAND_MAX - 1;
                            ^
wave.h:245:33: error: ‘RAND_MAX’ was not declared in this scope
         return (2.0 * rand()) / RAND_MAX - 1;
                                 ^
AakashRaina commented 9 years ago

If you intended to generate a random number,try using srand() instead.Regarding rand_max you will have to define it.

mtytel commented 9 years ago

https://github.com/mtytel/cursynth/pull/12 fixes this issue. I don't think srand is right since it sets the seed.