При создании веб-сервера с помощью proxygen
, Я включен proxygen::HTTPServer
в другом подкаталоге, и я получаю ошибку.
Но
Я включил ту же библиотеку в другой каталог, но не могу получить ошибку.
In file included from /usr/local/include/folly/FBString.h:60:0,
from /usr/local/include/folly/Demangle.h:19,
from /usr/local/include/folly/Conv.h:40,
from /usr/local/include/folly/String.h:27,
from /usr/local/include/folly/io/async/SSLContext.h:35,
from /usr/local/include/wangle/ssl/SSLContextConfig.h:19,
from /usr/local/include/proxygen/httpserver/HTTPServer.h:12,
from /home/skyend/ds/sentencer-backend-engine/include/router/src/Router.h:9,
from /home/skyend/ds/sentencer-backend-engine/include/router/src/Router.cpp:5:
/usr/local/include/folly/memory/Malloc.h: In lambda function:
/usr/local/include/folly/memory/Malloc.h:196:38: error: inconsistent types ‘int’ and ‘bool’ deduced for lambda return type
return (origAllocated != *counter);
включают в себя / маршрутизатор / CMakeListx.txt
add_library(sbx_router src/Router.cpp src/Router.h)
target_link_libraries(sbx_router r3 folly)
include / router / src / Router.h (Ошибка)
#include <iostream>
#include <router/src/r3.h>
#include <proxygen/httpserver/HTTPServer.h>
#include <proxygen/httpserver/RequestHandlerFactory.h>
SRC / HTTP / сервис / CMakeLists.txt
add_library(sbx_services
LoggingHandlerFactory.h)
src / http / service / LoggingHandlerFactory.h (Well Compile)
#include "libs/stringUtils.h"#include <proxygen/httpserver/HTTPServer.h>
#include <proxygen/httpserver/RequestHandlerFactory.h>
#include <boost/algorithm/string.hpp>
#include <vector>
namespace sbx::http::service {
class LoggingHandlerFactory : public proxygen::RequestHandlerFactory {
public:
void onServerStart(folly::EventBase * /*evb*/) noexcept override {}
void onServerStop() noexcept override {}
proxygen::RequestHandler *onRequest(proxygen::RequestHandler * nextHandler, proxygen::HTTPMessage * msg) noexcept override {
std::string method = "unknown";
if( msg->getMethod().hasValue() ) {
method = proxygen::methodToString(msg->getMethod().value());
}
std::cout << "[" << method << "] " << msg->getPath() << std::endl;
if( nextHandler != nullptr ){
return nextHandler;
}
}
};
}
CMakeLists.txt
...
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
# Things to always src as flags. Change as needed.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# Build-type specific flags. Change as needed.
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
...
почему возникает ошибка?
router.h: 9
#include <proxygen/httpserver/HTTPServer.h>
Router.cpp: 5
#include <proxygen/httpserver/HTTPServer.h>
Спасибо за помощь.
Задача ещё не решена.
Других решений пока нет …