这是我的标题level.h
:
#ifndef LEVEL_H_
#define LEVEL_H_
#include <string>
#include <map>
#include <queue>
#include <list>
typedef struct {
std::string title;
int stepsAmount;
std::queue <std::list <char> > steps;
std::queue <std::map <std::string, int> > stepsOptions;
} Level;
std::string getCurrentStepExpression(Level* level);
#endif
我的level.cpp
:
#include "level.h"
std::string getCurrentStepExpression(Level* level) {
std::string result;
if (level)
result = level->stepExpressions.front();
return result;
}
一切似乎都很好,但编译器说:
..\level.cpp: In function 'std::string getCurrentStepExpression(Level*)':
..\level.cpp:12:19: error: 'struct Level' has no member named 'stepExpressions'
为什么它看不到我的结构的字段?