C++主文件有未声明的标识符,该标识符在头文件(XCODEL)中声明

C++主文件有未声明的标识符,该标识符在头文件(XCODEL)中声明,c++,xcode,undeclared-identifier,C++,Xcode,Undeclared Identifier,Xcode声明在我的主文件中,stdDev是一个未声明的标识符,但它已在头文件中声明。我完全不知道该怎么解决这个问题。我将非常感谢您的帮助 #include <iostream> #include <string> #include <cmath> #include "Person.hpp" using namespace std; int main() { Person personRob("Rob", 95); Person personBob("Bo

Xcode声明在我的主文件中,stdDev是一个未声明的标识符,但它已在头文件中声明。我完全不知道该怎么解决这个问题。我将非常感谢您的帮助

#include <iostream>
#include <string>
#include <cmath>
#include "Person.hpp"
using namespace std;


int main()
{
Person personRob("Rob", 95);
Person personBob("Bob", 89);
Person personGob("Gob", 99);

Person personArray[] = {personRob, personBob, personGob};

Person whole_class;

cout << "Standard deviation is: " << stdDev /* where Xcode is saying that stdDev is an undeclared identifier */ << endl;

return 0;
}
person.hpp:

#include <iostream>
#include <string>

#ifndef PERSON_HPP
#define PERSON_HPP

class Person

{

private:

    std::string name;
    double age;

public:
    Person(std::string = " ", double = 0.0);
    std::string getName();
    double getAge();
    double stdDev(Person personArray[], int size);

 };

 #endif
stdDev声明为非静态成员函数。为了使用它,您需要在具有适当参数的对象上调用它,例如:

std::cout << whole_class.stdDev(personArray, 3)

如果看不到Person.hpp的内容,就很难判断出哪里出了问题。我添加了头文件filestdev是一个方法。它需要在Person的实例上调用。比如cout,stdDev定义在哪里?有一个方法使用这个名称,但你可能不是这个意思,如果你这样做了,你需要回到基本的。
std::cout << stdDev(personArray, 3)