当我使用make命令时,它会提示以下语句。
Main. cpp: 10:9: Error: 'SIGPIPE' has not been declared in this scope
signal(SIGPIPE, SIG_IGN);
^
main. cpp: 10:18: Error: 'SIG_ IGN '...
signal(SIGPIPE, SIG_IGN);
^
main. cpp: 10:25: Error: 'signal'...
signal(SIGPIPE, SIG_IGN);
^
这是main.cpp的代码。
#include <signal.h>
#include "log.h"
#include "server.h"
int main(int argc, char* argv[])
{
signal(SIGPIPE, SIG_IGN);
Log::getLog()->init();
LOG_INFO("complete init!");
Server server(10000);
server.init(5);
server.serverListen();
return 0;
}
这是CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(MyWebServer)
include_directories(${CMAKE_SOURCE_DIR}/server)
link_directories(/lib64)
set(CMAKE_BUILD_TYPE Release)
add_compile_options(-std=c++11)
aux_source_directory(./server SRC)
add_executable(WebServer ${SRC})