#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
我需要此代碼的幫助。我的編譯器不斷要求我使用-fpermissive選項,但我不知道在哪裏輸入它。我粘貼了下面的代碼和顯示的錯誤。- 代碼塊中的最佳選項。我在哪裏可以放入「-foumissive」選項?
using namespace std;
int cx = 0, cy = 0;
double x =0, y=0, r = 5;
int main(){
ofstream myfile;
myfile.open("dingo.txt");
for(int g =0 ; g <= 360; g++)
//find x and y
//Get points of a circle.
x = cx + r * cos(g);
y = cy + r * sin(g);
//This is what pops up below:
//In function int main()':
//Error: name lookup of 'g' changed for ISO 'for' scoping [-fpermissive]
//note: (if you use '-fpermissive' G++ will accept your code)
//where should I enter the required option?
myfile << "X: " << x << "; Y: " << y <<endl;
myfile.close();
return 0;
}
您不應該使用'-fpermissive',而應該修復代碼中的錯誤。 –
爲什麼你想使用'-fpermissive'而不是修復你的代碼? –
即使你使用'-fpermissive',代碼也不會做你想要的。 – hvd