Hypotenuse Problem

This is a discussion on Hypotenuse Problem within the C Programming forums, part of the General Programming Boards category; I am working on a problem for class and I am getting a [Linker error] undefined reference to `hypotenuse(double, double)' ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    42

    Hypotenuse Problem

    I am working on a problem for class and I am getting a
    [Linker error] undefined reference to `hypotenuse(double, double)' message. Can someone explain why this is happening. Here is my code:

    Code:
    #include <stdio.h>
    #include <math.h>
    
    /* Function Prototype */
    double hypotenuse( double sidea, double sideb );
    
    /* Function main begins program execution */ 
    int main() 
    {
        double sidea; /* Variable in which sidea will be stored */
        double sideb; /* Variable in which sideb will be stored */
        
        printf( "Enter the length of side a: \n" ); /* Prompt for input */
            scanf( "%lf", &sidea); /* Read number from user */ 
        printf( "Enter the length of side b: \n\n" ); /* Prompt for input */
            scanf( "%lf", &sideb); /* Read number from user */
        printf( "The length of side c is %lf", hypotenuse( sidea, sideb ) ); /* Display results */
                       
      return 0; /* Indicates that program ended successfully */ 
     
    } /* End function main */
    
    double hypontenuse( double sidea, double sideb )
    {
    
        return sqrt( pow( sidea, 2) + pow( sideb, 2) );
        
    } /* End function main */
    Thanks in advance

    DMKanz07

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    Code:
    } /* End function main */
    
    double hypontenuse( double sidea, double sideb )
    {
    
        return sqrt( pow( sidea, 2) + pow( sideb, 2) );
    hypontenuse?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    42
    Thank you - I feel silly for missing that. I guess that is what happens when you stare for to long

    Thanks again

    DMKanz07

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21