gpt4 book ai didi

c++ - 第一次用户的 devc++ 编译错误

转载 作者:行者123 更新时间:2023-11-28 06:56:56 24 4
gpt4 key购买 nike

我有这个代码

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
double a,b,c;
double x,x2;
cout<<"Give a: ";
cin>>a;
cout<<"Give b: ";
cin>>b;
cout <<"Give c: ";
cin>>c;
if (a==0)
{
if (b==0)
{
if (c==0)
{
cout<<"Solution indeterminable";
return 0;
}
else
{
cout<<"No solution";
return 0;
}
}
else
{
x=-c/b;
cout<<"The only root is x: "<<x;
return 0;
}

}
else
{
double b_sqr=b*b;
if (b_sqr>4*b*c)
{
cout<<"Complex roots: ";
return 0;
}
else if (b_sqr==4*b*c)
{
x=-b/(2*a);
cout<<"The only solution is x: "<<x;
return 0;
}
else
{
x=-b+(sqrt((b*b)-(4*a*c)))/(2*2);
x2=-b-(sqrt((b*b)-(4*a*c)))/(2*2);
cout<<"The first root is x1: "<<x;
cout<<"The first root is x2: "<<x2;
return 0;
}
}
}

当我尝试使用 devc++ 进行编译时,出现了以下错误:

found dwarf version '4', this reader only handles version 2 information. 
[Linker error] undefined reference to `__dyn_tls_init_callback'
[Linker error] undefined reference to `__cpu_features_init'
[Linker error] undefined reference to `__chkstk_ms'
[Linker error] undefined reference to `__mingw_glob'
[Linker error] undefined reference to `__mingw_glob'
ld returned 1 exit status

这是我第一次使用 devc++。代码似乎没问题。有任何想法吗?我使用的平台是Windows 7 64位版本。

最佳答案

我认为您收到此错误是因为您的编译器路径设置不正确。

这可能对你有帮助:

Tools > Compiler Options... 并添加编译器文件夹。

关于c++ - 第一次用户的 devc++ 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23035967/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com