代码块中的-fpermissive选项.我在哪里放置"-fpermissive"?选项? [英] -fpermissive option in codeblocks. Where do I put that "-fpermissive" option?
本文介绍了代码块中的-fpermissive选项.我在哪里放置"-fpermissive"?选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
我需要有关此代码的帮助.我的编译器一直要求我使用-fpermissive选项,但我不知道在哪里输入它.我已经粘贴了下面的代码和显示的错误.
I need help with this code. My compiler keeps asking me to use the -fpermissive option but I don't know where to input it. I've pasted the code below and the error that is shown.
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;
}
推荐答案
您可以在设置"
> 中的
其他选项"
下添加更多编译器标志.编译器"
You can add more compiler flags under "Other Options"
in "Settings"
> "Compiler"
尽管我认为您应该先修复代码.例如, std :: sin
和 std :: cos
接受弧度,而不接受度数.您还需要在 for
语句周围加括号.
Although I think you should fix your code first. For example, std::sin
and std::cos
accepts radians, not degrees. You also need braces around your for
statement.
for(int g =0 ; g <= 360; g++) {
//code here.
}
这篇关于代码块中的-fpermissive选项.我在哪里放置"-fpermissive"?选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文