简体   繁体   中英

Unresolved external symbol _printf referenced in function _main

I'm a complete newbie at C programming and I was writing a program and it started throwing the below error:

error LNK2019 unresolved external symbol_printf referenced in function_main

I'm using the C compiler.

My code is shown below:

#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 is case-sensitive and you're calling Printf instead of printf .

C is also very typo-sensitive, and you have some in your questions and variable name, so beware...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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