代码块中的-fpermissive选项.我在哪里放置"-fpermissive"选项?

ART*_*HUR 1 c++ codeblocks

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
Run Code Online (Sandbox Code Playgroud)

我需要这个代码的帮助.我的编译器一直要求我使用-fpermissive选项,但我不知道在哪里输入它.我已经粘贴了下面的代码和显示的错误.

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;

}
Run Code Online (Sandbox Code Playgroud)

Rap*_*ptz 5

您可以"Other Options""Settings">中添加更多编译器标志"Compiler"

在此输入图像描述

虽然我认为你应该先修复你的代码.例如,std::sinstd::cos接受弧度,而不是度数.你还需要围绕你的for陈述大括号.

for(int g =0 ; g <= 360; g++) {
    //code here.
}
Run Code Online (Sandbox Code Playgroud)