fix link error

This commit is contained in:
CJ Cobb
2020-12-15 13:44:16 -05:00
parent 9d99294953
commit 1d737014e9
3 changed files with 25 additions and 14 deletions

View File

@@ -11,7 +11,11 @@ project(reporting)
cmake_minimum_required(VERSION 3.17)
set (CMAKE_CXX_STANDARD 17)
FIND_PACKAGE( Boost 1.75 COMPONENTS thread system log REQUIRED )
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
FIND_PACKAGE( Boost 1.75 COMPONENTS log log_setup thread system REQUIRED )
add_executable (reporting
websocket_server_async.cpp

View File

@@ -1,5 +1,4 @@
#define BOOST_LOG_DYN_LINK 1
//------------------------------------------------------------------------------
/*

View File

@@ -230,14 +230,22 @@ private:
std::optional<boost::json::object>
parse_config(const char* filename)
{
std::ifstream in(filename, std::ios::in | std::ios::binary);
if (in)
try
{
std::stringstream contents;
contents << in.rdbuf();
in.close();
boost::json::value value = boost::json::parse(contents.str());
return value.as_object();
std::ifstream in(filename, std::ios::in | std::ios::binary);
if (in)
{
std::stringstream contents;
contents << in.rdbuf();
in.close();
std::cout << contents.str() << std::endl;
boost::json::value value = boost::json::parse(contents.str());
return value.as_object();
}
}
catch (std::exception const& e)
{
std::cout << e.what() << std::endl;
}
return {};
}
@@ -247,12 +255,12 @@ int
main(int argc, char* argv[])
{
// Check command line arguments.
if (argc != 4)
if (argc != 5)
{
std::cerr
<< "Usage: websocket-server-async <address> <port> <threads>\n"
<< "Example:\n"
<< " websocket-server-async 0.0.0.0 8080 1\n";
std::cerr << "Usage: websocket-server-async <address> <port> <threads> "
"<config_file> \n"
<< "Example:\n"
<< " websocket-server-async 0.0.0.0 8080 1\n";
return EXIT_FAILURE;
}
auto const address = net::ip::make_address(argv[1]);