0

I was getting an error of "undefined reference" to gcd(long, long).

This is my gcd.cc file:

#include <gcd.h>
#include <iostream>
using namespace std;

int main() 
{
    long a,b;
    
    cout << "Enter the first number ---> ";

    cin >> a;

    cout << "Enter the second number ---> ";

    cin >> b;
    
    cout <<"The gcd of " <<  a << " and " <<  b << " is "
         << gcd ( a, b) << endl;

    return 0;
}

This is my gcd.h file:

#ifndef GCD_H
#define GCD_H

long gcd (long a, long b) ;

#endif
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770

0 Answers0