I am new to C++ and i don't understant this error message i am recieving. Could you show me the solution? ([Error] name lookup of 'n' changed for ISO 'for' scoping [-fpermissive]) line 25, col 17 (the 'n' is the problem)
#include <cstdlib>
#include <iostream>
#include <math.h>
#include "dp_lib.h"
using namespace std;
int main()
{
double pi=3.141592653589793238462643383279502884197169399375;
float value;
unsigned long length = 44100; // sample rate
int freq = 1000;
int t = 1;
int amp = 10; // size of the wave
FILE* fp = fopen("data.csv", "wb"); // open file
// loop to generate audio samples
for(int n=0; n < length; n++) //where n is the step
int t = n/freq; //t/freq
{
value = amp*sin(2*pi*freq*t);
write_CSV(n, value, fp);
cout << n << "\t" << value <<"\n";
}
fclose(fp); // close file
free(fp); // release memory
cout << "\n\n";
system ("pause");
}
Thank you very much