gpt4 book ai didi

c - 未定义对 `Function' C 的引用

转载 作者:太空宇宙 更新时间:2023-11-04 07:03:08 25 4
gpt4 key购买 nike

<分区>

我已经研究了这个错误的解决方案,但我还是不明白。

#include <stdio.h>

float calcF(float a, float b, float c);

int main(void)
{
float mag_flux_den, cur, len;
float result;

printf("What is the magnetic flux density in tesla? : ");
scanf("%f", &mag_flux_den);
printf("What is the current in the conductor in Amperes? : ");
scanf("%f", &cur);
printf("What is the length of the conductor in the magnetic field in metres? : ");
scanf("%f", &len);

result = calcF(mag_flux_den, cur, len);

printf("Force on the current carrying conductor: %f", result);
return 0;
}

float calcf(float a, float b, float c) //calculates force on the current carrying conductor{
float F;
F = a * b * c;
return F;
}

我正在使用 ideone.com,但仍然收到相同的错误消息(undefined reference to 'calcF')。任何帮助将不胜感激。

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