Thread: Erro: Referenced in function _main

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    44

    Erro: Referenced in function _main

    I've been working on this program and every time I run it I get two errors that say:

    error LNK2019: unresolved external symbol _input_TempInfo referenced in function _main

    error LNK2019: unresolved external symbol _input_Num_TempInfo referenced in function _main

    Here's my code

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    struct TempInfo
    {
        int day;
        double fahr; 
        double celsius;
    };
    
    struct TempInfo input_TempInfo (void);
    void print_TempInfo (struct TempInfo);
    int input_Num_TempInfo (void);
    
    int main (void)
    {
        struct TempInfo temparray[20];
        int i, numTempInfo;
    
        numTempInfo = input_Num_TempInfo();
    
        printf ("Entering the %i temperature info \n", numTempInfo);
        for (i = 0; i < numTempInfo; i++)
        {
            temparray [i] = input_TempInfo();
        }
    
        return 0;
    }
    
    struct TempInfo input_Tempinfo (void)
    {
        struct TempInfo hold;
    
        printf ("\nEnter in the day (1-366): ");
        scanf ("%i", &hold.day);
    
        while ((hold.day < 1) || (hold.day > 366))
        {
            printf ("\nDay is out of range, please re-enter: ");
            scanf ("%i", &hold.day);
        }
    
        printf ("Enter in the fahrenheit temperature");
        scanf ("%lf", &hold.fahr);
        
        hold.celsius = (hold.fahr - 32) * 5/9 ;
    
        return hold;
    
    }
    Any feedback would be great

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Well, where is your implementation of input_Num_TempInfo()? You declare it and use it, but there is no implementation in the code you posted.

    Edit: The other issue is related to spelling, you declare your function like this input_TempInfo, but the implementation is spelled like this: input_Tempinfo.
    Last edited by Subsonics; 04-14-2012 at 01:22 PM.

  3. #3
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    You don't have an implementation of input_TempInfo either. Check the spelling and case carefully.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  4. #4
    Registered User
    Join Date
    Jun 2010
    Location
    Michigan, USA
    Posts
    143
    Edit: Already covered.
    Last edited by pheininger; 04-14-2012 at 01:32 PM. Reason: Already covered.

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    44
    Thanks for taking a look at my code. It runs like a champ now!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-10-2012, 08:49 PM
  2. recursive function call to "_main"
    By Evade in forum C Programming
    Replies: 2
    Last Post: 11-02-2010, 01:23 PM
  3. erro help newbie at C++
    By raze in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2006, 09:47 AM
  4. The simplest Program, but an erro , need help
    By nitehawk in forum Windows Programming
    Replies: 10
    Last Post: 10-14-2005, 03:18 AM
  5. erro opening a lib
    By Kaho in forum C++ Programming
    Replies: 1
    Last Post: 08-27-2005, 08:42 AM