【发布时间】:2016-01-29 00:00:21
【问题描述】:
这是我的代码。为什么找不到“第一”?
.h 文件
/*
* Student.h
*
* Created on: Jan 28, 2016
* Author: Clint Sullivan
*/
#ifndef STUDENT_H_
#define STUDENT_H_
#include <iostream>
#include <string>
using namespace std;
class Student {
struct Address{
string street;
string city;
string state;
string zipcode;
};
private:
int eid;
string first;
string last;
Address campusAddress;
Transcript transcript;
public:
Student();
int getEID() const;
string getFirst() const;
string getLast() const;
Address getCampusAddress() const;
Transcript getTranscript() const;
void setEid(const int eid);
void setFirst(const string& first);
void setLast(const string& last);
void setCampusAddress(const Address& campusAddress);
void setTranscript(const Transcript& transcript);
string toString() const;
};
/* namespace std */
#endif /* STUDENT_H_ */
.cpp 文件:
/*
* Student.cpp
*
* Created on: Jan 28, 2016
* Author: Clint Sullivan
*/
#include <sstream>
#include "Student.h"
using namespace std;
struct Address;
Student::Student()
{
}
string Student::getFirst() const {return first; } //member declaration not found, symbol 'first' could not be resolved
有什么建议吗?
【问题讨论】:
-
修复代码中不存在的
Transcript后,我can't reproduce the problem。请发帖minimal reproducible example。 -
谷歌搜索我得到的错误:stackoverflow.com/a/15532166/2475059 你在使用 Eclipse 吗?
标签: c++