功能标识符是未定义的C
Function identifier is undefined C++
所以我在C 中写了一个函数,该功能是一个小数据库,其中包含两个类别,运动和饮食。这两个类非常相似,基本上是完全相似的。无论如何,我正在尝试打印运动课的内容。但是,我收到一条错误消息,即StoreDailyPlan不确定。这很有趣,因为两个课程都有自己的超载功能的版本,而且饮食版本正常。
void Wrapper::storeWeeklyPlan(ofstream& outfile, list<DietPlan>& dietlist)
{
DietPlan Node;
list<DietPlan>::iterator it; //this is our iterator, a pointer to the nodes in our list.
for(it = dietlist.begin(); it != dietlist.end(); it++) // start it at beginning, watch until end, and iterate it.
{
Node = *it;
storeDailyPlan(Node, outfile);
} //Another error here
}
void storeWeeklyPlan(ofstream& outfile, list<ExercisePlan>& exerciselist)
{
ExercisePlan Node;
list<ExercisePlan>::iterator it;
for (it = exerciselist.begin(); it != exerciselist.end(); it++)
{
Node = *it;
storeDailyPlan(Node, outfile); //THIS IS THE ERROR LINE
}
}
void Wrapper::storeDailyPlan(DietPlan diet, ofstream& outfile)
{
outfile << diet;
}
void Wrapper::storeDailyPlan(ExercisePlan exercise, ofstream& outfile)
{
outfile << exercise;
}
上面是将信息打印到文件上的4个函数。以下是其他一些相关代码。
class Wrapper
{
public:
Wrapper();
~Wrapper();
void runApp();
private:
int displayMenu();
void doChoice(int choice, list<DietPlan>& dietList, list<ExercisePlan>& exerciselist);
void loadDailyPlan(DietPlan& diet, ifstream& infile);
void loadDailyPlan(ExercisePlan& exercise, ifstream& infile);
void loadWeeklyPlan(ifstream& infile, list<DietPlan>& dietlist);
void loadWeeklyPlan(ifstream& infile, list<ExercisePlan>& exerciselist);
void storeWeeklyPlan(ofstream& outfile, list<DietPlan>& dietlist);
void storeWeeklyPlan(ofstream& outfile, list<ExercisePlan>& exerciselist);
void storeDailyPlan(DietPlan diet, ofstream& outfile);
void storeDailyPlan(ExercisePlan exercise, ofstream& outfile);
list <DietPlan> dietlist; //doubly linked list of DietPlan nodes. This is where it lives.
list <ExercisePlan> exerciselist;
};
如果您想查看任何其他代码,请告诉我。就像我说的那样,超载功能的饮食版本很好。
我得到的错误是标识符" StoredailyPlan"不确定,并且'StoreDailyPlan':找不到标识符
我正在使用Visual Studio2015。
您在storeWeeklyPlan
的定义之前丢失了Wrapper::
。
storeWeeklyPlan
的声明中有一个错字。
// Replace this
void storeWeeklyPlan(ofstream& outfile, list<ExercisePlan>& exerciselist)
// With this
void Wrapper::storeWeeklyPlan(ofstream& outfile, list<ExercisePlan>& exerciselist)
相关文章:
- Visual Studio C++ PlaySound 标识符未定义
- 删除动态数组时未定义标识符
- 未定义的标识符/未声明
- 标识符Class_name未定义C++ oop
- 标识符"hWnd"未定义
- 为什么更改包含 psapi.h 的顺序会产生编译错误?(标识符 BOOL 未定义)
- Visual Studio 2019 概念标识符未定义
- 标识符"DDRB"未定义 - VS code / Visual Studio
- 在头文件中使用opencv类型来实现未定义的标识符
- 标识符"in"未定义
- 智能感知:标识符"node"未定义
- 标识符"__readgsqword"未定义 - Visual Studio 2017
- 标识符"V 未定义
- 标识符"thread"未定义
- 标识符uint8_t未定义 - Visual Studio 2017
- 未定义的标识符 - 缺少哪些头文件?- DX12.
- 调用函数时未定义标识符"function_name"
- Wininet未定义标识符
- 简单代码问题-未定义标识符
- 试图编写函数的未定义标识符