繁体   English   中英

函数_main中引用的未解析的外部符号_printf

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM