[英]Unresolved external symbol _printf referenced in function _main
我是C編程的新手,正在編寫程序,它開始引發以下錯誤:
錯誤LNK2019無法解析的外部symbol_printf在function_main中引用
我正在使用C編譯器。
我的代碼如下所示:
#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也是對打字錯誤敏感的,並且您的問題和變量名中也包含一些內容,因此請注意...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.