#include <iostream>
#include <cmath>

using namespace std;

int main()
{//begin main
double hypot(double,double);
double base;
double height;

cout<<"Program to compute the Hypotenuse of a given right triangle. \n"<<endl;
cout<<"Enter the base: \n"<< endl;
cin>>base;
cout<<"Enter the height: \n"<<endl;
cin>>height;
cout <<"The hypothenus of given triangle is " << hypot(base,height) <<endl;

system("pause");

return 0;
}//end main

double hypot(double base, double height)
{//begin function
       
double newb=pow(base,2.0);
double newh=pow(height,2.0);
double newa=newb+newh;
double hyp= pow(newa,.5);

return hyp;
}//end function

[Linker error] undefined reference to `hypot(double, double)'

Why is this happening?

function declarations must be declared before main(), not inside.

int main()
{//begin main
double hypot(double,double);
....

should be

double hypot(double, double);

int main()
{
...

give that a try

~J

you are absolutely right, thanks :)

In actual fact it does not matter in C and C++ where a function prototype was placed if it stands before function using.
What a (bad) compiler are you using?

Apropos, why you compute simplest x*x as pow(x,2.0)?
You don't test input results. Try to enter (misprint) not-a-number...
Avoid using standard library names for your own functions. There is hypot function in <ccmath> (but it has extern "C" linkage).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.