Help with fatal errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ichabod079
    New Member
    • Mar 2008
    • 3

    #1

    Help with fatal errors

    I'm new to C++ and I am struggling with the whole separate function thing and I am so frustrated right now it's not even funny. What i'm supposed to do is this code and I ask for the 1st number and the 2nd number and then output the quotient and remainder. So I did the code and I fixed most of the errors and now I have 2 errors that say:

    1>C:\Users\Rebe cca Vance\Documents \Visual Studio 2005\Projects\H W_3b\Debug\HW_3 b.exe : fatal error LNK1120: 1 unresolved externals


    1>3b.obj : error LNK2019: unresolved external symbol "int __cdecl GetRemainder(vo id)" (?GetRemainder@ @YAHXZ) referenced in function _main


    I don't know what these mean. Here is my code. Please someone help me!

    # include <iostream>
    using namespace std;

    int GetNum1 ();
    int GetNum2 ();
    int GetQuotient ();
    int GetRemainder ();
    void PrintSum (int, int, int, int);

    int main ()
    {
    int num1;
    int num2;
    int quotient;
    int remainder;
    num1=GetNum1 ();
    num2=GetNum2 ();
    quotient=GetQuo tient ();
    remainder=GetRe mainder ();
    return 0;
    }

    int GetNum1 ()
    {
    int num1;
    cout << "Enter first number\n";
    cin >> num1;
    return num1;
    }

    int GetNum2 ()

    {
    int num2;
    cout <<"Enter second number\n";
    cin >> num2;
    return num2;
    }

    int GetQuotient ()

    {int num1;
    int num2;
    int quotient;
    quotient=num1/num2;
    return quotient;
    }

    int GetRemainer ()

    {int num1;
    int num2;
    int remainder;
    remainder=num1% num2;
    return remainder;
    }

    void PrintSum ()
    {int num1;
    int num2;
    int quotient;
    int remainder;
    cout << num1 << "divided by "<< num2<< " equals " << quotient << " with a remainder of "<<remainder<<" .\n";
    }
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    int GetRemainer ()
    See a problem with your spelling? Here's how I found your problem. I saw that you had a linking problem, with an unresolved external symbol called GetRemainder. It's a function, because of the syntax int _cdecl GetRemainder(vo id). I got this information from the error message.

    The linker would complain about a missing function if you tried to use a function, but didn't have code for it. If you misspell the function name, well the compiler's not going to find it, right?

    In the future, use CODE tags. They are mandatory for blocks of code like yours.

    Comment

    • ichabod079
      New Member
      • Mar 2008
      • 3

      #3
      ok thank you so much for your help :)

      Comment

      Working...