对函数的未定义引用?C++

对函数的未定义引用?C++,c++,C++,我有以下代码,我得到了这个错误: /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)' 我理解这个错误,但我无法找出代码中的错误 #in

我有以下代码,我得到了这个错误:

/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)'
我理解这个错误,但我无法找出代码中的错误

#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;
}     

转发声明与定义不匹配

void requestVariables(short, short, short);
应该是

void requestVariables(short &, short &, short &);

转发声明与定义不匹配

void requestVariables(short, short, short);
应该是

void requestVariables(short &, short &, short &);

啊,我明白了,非常感谢你!我一定跳过了函数原型,因为它是偶然通过引用传递的。@bbchan铿锵标志-Wmissing prototype检测到这一点,如果您碰巧使用了该编译器,它将警告定义不匹配prototype@M.M我必须尝试一下,看看效果如何——我现在正在使用GCC。谢谢啊,我明白了,非常感谢你!我一定跳过了函数原型,因为它是偶然通过引用传递的。@bbchan铿锵标志-Wmissing prototype检测到这一点,如果您碰巧使用了该编译器,它将警告定义不匹配prototype@M.M我必须尝试一下,看看效果如何——我现在正在使用GCC。谢谢对于修改后的参数,最好使用指针,而不是引用。这样,阅读调用者的人就可以知道参数被修改是因为使用了引用运算符&我不同意上述观点。@EdwardKarak这是运算符的地址,而不是引用运算符。@M.M引用运算符&@M.M.谁在乎呢,许多源称之为引用运算符,而其他源称之为地址运算符。这就像K&R vs OTB一样,最好使用指针,而不是引用来修改参数。这样,阅读调用者的人就可以知道参数被修改是因为使用了引用运算符&我不同意上述观点。@EdwardKarak这是运算符的地址,而不是引用运算符。@M.M引用运算符&@M.M.谁在乎呢,许多源称之为引用运算符,而其他源称之为地址运算符。这就像K&R vs OTBS的崩溃