C++ 错误说明静态成员函数未定义,但我定义了它?

C++ 错误说明静态成员函数未定义,但我定义了它?,c++,static,C++,Static,我肯定错过了一些明显的东西,谢谢你的帮助。 C++中的编码。IDE是Clion。 在main.cpp中,我调用一个Parser::parse(tokenList)函数。 Parse函数在Parser.h中声明为static std::string Parse(std::vector&tokenList) 我将Parser.cpp中的函数定义为std::string Parser::parse(std::vector&tokenList){return”“;} 在main.cpp文件中,我#包括“

我肯定错过了一些明显的东西,谢谢你的帮助。 C++中的编码。IDE是Clion。 在main.cpp中,我调用一个
Parser::parse(tokenList)
函数。 Parse函数在Parser.h中声明为
static std::string Parse(std::vector&tokenList)
我将Parser.cpp中的函数定义为
std::string Parser::parse(std::vector&tokenList){return”“;}
在main.cpp文件中,我
#包括“Parser.h”
当我构建我的项目时,我得到了对“Parser::parse(std::vector&)”的
未定义的引用。
我的定义有误吗?
我有相同问题的类似代码。在该示例中,包含.cpp文件而不是.h文件可以解决此问题。为什么会这样(是的,我知道包含.cpp是一种不好的做法)?

与代码相比,代码描述显得苍白。您应该编译所有的.cpp文件。欢迎使用堆栈溢出。请阅读,带上SO,阅读,以及。最后,请学习如何更新您的帖子,例如,如何改进他们的帖子,以及如何在帖子中添加新的内容。