在一个c++的.h文件中加入了这段代码:

#include <string>

 

using namespace std;

 

std::string escapeStr(const std::string& input)

{

       return std::string(input);

}

 

结果总是报错:

one or more multiply defined symbols found.

 

这是怎么回事那?

[解决方法]

在.h文件中只能放函数的声明,不要放函数体. 函数体要放到.cpp文件中去.

posted on 2018-05-23 16:11  今夜太冷  阅读(3613)  评论(0编辑  收藏  举报