I have the following code and I am getting this error:
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccoDcMi1.o: in function `main':
activity17.cpp:(.text+0x19): undefined reference to `requestVariables(short, short, short)'
I understand the error, but I can't figure out what is wrong in my code.
#include <iostream>
#include <cmath>
#include <iomanip>
void requestVariables(short, short, short);
void longestPole(short, short, short);
int main(){
short l, w, h;
requestVariables(l, w, h);
longestPole(l, w, h);
return 0;
}
void requestVariables(short &l, short &w, short &h){
std::cout << "Enter the length, width, and height of a room in meters:" << std::endl;
std::cin >> l >> w >> h;
}
void longestPole(short l, short w, short h){
float longest = sqrt(l*l+w*w+h*h);
std::cout << "The longest pole that can fit in this room is: " << std::setprecision(2) << std::fixed << longest << std::endl;
}