C++ 对 class 构造函数的未定义引用

c++ undefined refernce to class constructer

//Header FILE:
#ifndef BMI_H_INCLUDED
#define BMI_H_INCLUDED

#include<iostream>
#include<string>
using namespace std;
class BMI{
public:
//default constructer
BMI();
//overloaded
BMI(string,int,double);
private:
string newName;
int newHeight;
double newWeight;
};


#endif // BMI_H_INCLUDED
//Implementation file:
#include "BMI.h"
BMI ::BMI(){
newHeight=0;
newWeight=0.0;

}
BMI::BMI(string name,intheight,double weight){
newName=name;
newHeight=height;
newWeight=weight;
}
//Main file:
#include <iostream>
#include<string>
#include "BMI.h"
using namespace std;

int main()
{
string name;
int height;
double weight;
cout<<"Name:\n";
getline(cin,name);
cout<<"Height(Inches):\n";
cin>>height;
cout<<"Weight(Pounds):";
cin>>weight;
BMI person_1("John",89,90.0);
//I get the error on the above line error is             //undefinedreferenceto`BMI::BMI(std::string, int, double)'



}

有谁知道为什么这种情况总是发生在我身上?

我使用 Codeblocks,如果可以,我该如何解决这个问题并防止它再次发生。

每次我将 类 分成头文件和 cpp 文件时都会发生这种情况。这只是我的程序因此而无法编译的许多次之一。

BMI::BMI(string name,intheight,double weight){中int和height之间没有space。

这会导致 BMI person_1("John",89,90.0); 引用不存在的构造函数。