我试着在Restbed的自述文件中运行这个示例,下面的代码行
request->get_header("Content-Type", 0);似乎发出了以下错误:
more than one instance of overloaded function "restbed::Request::get_header" matches the argument list:
function "restbed::Request::get_header(const std::string &name, const std::string &default_value = "") const" (declared at line 101 of "/usr/include/corvusoft/restbed/request.hpp") --
function "restbed::Request::get_header(const std::string &name, const std::function<std::string (const std::string &)> &transform) const" (declared at line 103 of usr/include/corvusoft/restbed/request.hpp")我想知道这是为什么,以及如何解决这个问题。谢谢!
发布于 2021-02-11 13:15:04
通过Linux命令行安装时遇到相同的问题。我曾经在另一台计算机上使用过restbed,但由于这个错误,我发现它不再运行了。下面的代码为我解决了这个问题。
从删除当前安装开始。
sudo apt remove librestbed-dev.然后执行以下操作(可以在主目录中执行此操作)
下载源码:
git clone --recursive https://github.com/corvusorft/restbed.git(或)下载文件https://github.com/Corvusoft/restbed/archive/master.zip
mkdir restbed/build
cd restbed/build
cmake [-DBUILD_SSL=NO] .. 如果上述命令不起作用,请尝试将目录更改为restbed,然后运行步骤4命令。
make install
make test 如果您在此步骤中遇到问题,请尝试再次运行make install,然后运行make tests。出于某种原因,这解决了我的问题。
将头文件和库文件复制(或移动)到适当的位置
在restbed目录中:
cp -r distribution/include/* /usr/local/include会将头文件移动到g++知道要在其中查找头文件的本地包含目录中
同样,g++知道要在本地库目录中查找库,cp -a distribution/library/* /usr/local/lib会将库文件移到本地库目录中
最后一步:
sudo /sbin/ldconfig -vhttps://stackoverflow.com/questions/65435177
复制相似问题