C 函数_main中引用的未解析外部符号_printf
我是C编程的新手,当时我正在编写一个程序,它开始抛出以下错误: 函数\u main中引用的错误LNK2019未解析外部符号\u printf 我正在使用C编译器 我的代码如下所示:C 函数_main中引用的未解析外部符号_printf,c,C,我是C编程的新手,当时我正在编写一个程序,它开始抛出以下错误: 函数\u main中引用的错误LNK2019未解析外部符号\u printf 我正在使用C编译器 我的代码如下所示: #include <stdio.h> int main(void) { int EarthWeight; // Weight on earth float Mercurypercent, Venuspercent, Marspercent, Jupiterpercent,
#include <stdio.h>
int main(void)
{
int EarthWeight; // Weight on earth
float Mercurypercent, Venuspercent,
Marspercent, Jupiterpercent, Saturnpercent, Neptunepercent; // wieght percents
float Mercurywieght, Venusweight, Marsweight, Jupiterweight, Saturnweight, Neptuneweight; // wieght outputs
Mercurypercent = 0.378; // percent values of all the planets
Venuspercent = 0.907;
Marspercent = 0.377;
Jupiterpercent = 2.36;
Saturnpercent = 0.889;
Neptunepercent = 1.12;
printf("what is the Weight of the person on earth? "); // Grabs the weight on earth
scanf("%d", &EarthWeight);
Mercurywieght = EarthWeight * Mercurypercent;
Venusweight = EarthWeight * Venuspercent;
Marsweight = EarthWeight * Marspercent;
Jupiterweight = EarthWeight * Jupiterpercent;
Saturnweight = EarthWeight * Saturnpercent;
Neptuneweight = EarthWeight * Neptunepercent;
Printf("Your Weight on Earth is: %d\n", EarthWeight);
Printf("Your Weight on Mercury is: %f\n", Mercurywieght);
Printf("Your Weight on Venus is: %f\n", Venusweight);
Printf("Your Weight on Mars is: %f\n", Marsweight);
Printf("Your Weight on Jupiter is: %f\n", Jupiterweight);
Printf("Your Weight on Saturn is: %f\n", Saturnweight);
Printf("Your Weight on Neptune is: %f\n", Neptuneweight);
return 0;
}
C区分大小写,您调用的是Printf而不是Printf
C也是非常区分打字的,您的问题和变量名中有一些,所以请注意……C是区分大小写的,您调用的是Printf而不是Printf
C对输入错误也很敏感,您的问题和变量名中也有一些错误,因此请注意…确定“Printf”是错误的,但为什么链接器错误消息会标记为“\u Printf”,即小写的“p”?^^Hmm。。。你可能是对的。OP可能没有错误消息,因此在编辑器中键入时“隐藏”了问题。不管怎样-无论如何,你应该得到你的提升-我没有发现打字错误:当然“Printf”是错误的,但是为什么链接器错误消息标记为“\u Printf”,即小写的“p”?^^Hmm。。。你可能是对的。OP可能没有错误消息,因此在编辑器中键入时“隐藏”了问题。不管怎样-你应该得到你的支持-我没有发现错误:当发布错误消息时,确保你复制并粘贴错误消息,就像现在一样。我强烈怀疑您的错误消息与您发布的消息有点不同,在符号和函数后肯定有空格,因此真正的问题可能被隐藏。您还应该得到关于Printf隐式声明的错误/警告。。。不要忽略任何编译器消息,因为您应该用Printf替换Printf。在C语言中,符号和关键字也区分大小写。发布错误消息时,请确保按原样复制并粘贴错误消息。我强烈怀疑您的错误消息与您发布的消息有点不同,在符号和函数后肯定有空格,因此真正的问题可能被隐藏。您还应该得到关于Printf隐式声明的错误/警告。。。不要忽略任何编译器消息,因为您应该用Printf替换Printf。在C语言中,符号和关键字也区分大小写。