gpt4 book ai didi

c++ - 类外静态函数的声明不是定义

转载 作者:太空狗 更新时间:2023-10-29 23:33:38 27 4
gpt4 key购买 nike

我在使用 GCC 编译时遇到此错误:

error: declaration of 'static int utils::StringUtils::SplitString(const std::string&, const std::string&, std::vector<std::basic_string<char> >&, bool)' outside of class is not definition

代码:

标题:

namespace utils
{
/*
* This class provides static String utilities based on STL library.
*/
class StringUtils
{
public:
/**
* Splits the string based on the given delimiter.
* Reference: http://www.codeproject.com/Articles/1114/STL-Split-String
*/
static int SplitString( const std::string& input,
const std::string& delimiter,
std::vector<std::string>& results,
bool includeEmpties = true );
};
};

来源:

namespace utils
{
int StringUtils::SplitString( const std::string& input,
const std::string& delimiter,
std::vector<std::string>& results,
bool includeEmpties );
{
....
}
}

最佳答案

去掉源文件中定义末尾的分号!复制粘贴错误 =)

关于c++ - 类外静态函数的声明不是定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11750109/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com