Link errors when building websocketpp with example

2019-08-10 19:32发布

I'm having problems building websocketpp with examples on Windows 10.

Here is what I do:

I first open the CMake GUI, and specify "D:/third-party-software/websocketpp" (which is the directory to which I have cloned websocketpp) as the location of the source code and "D:/third-party-software/websocketpp/build" as the place to build the binaries.

Then I press the button Configure, which asks me if I want to create the build folder, which I choose to do, and then which generator I want to use for the project, any optional toolset to use (argument to -T), and which compiler to use, for which I choose "Visual Studio 15 2017 Win64", no optional toolset (empty string), and "use default native compiler", respectively.

Then I set the following parameters:

  • BUILD_EXAMPLES: <enabled>
  • BOOST_ROOT: "C:/Program1/boost/boost_1_67_0"
  • Boost_<LIBRARY-NAME>_LIBRARY_DEBUG and
    BOOST_<LIBRARY-NAME>_LIBRARY_RELEASE:
    "C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_<library-name>-vc141-mt-gd-x64-1_67.lib" and
    "C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_<library-name>-vc141-mt-x64-1_67.lib",
    respectively, for the libraries atomic, chrono, date_time, random, system and thread
  • Boost_INCLUDE_DIR: "C:/Program1/boost/boost_1_67_0/"
  • Boost_LIBRARY_DIR_DEBUG and Boost_LIBRARY_DIR_RELEASE: "C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1"

(I leave Boost_DIR uninitialized)

Then I press Configure again, which gives the output

* Configuring Boost
-- Using BOOST_ROOT
       C:/Program1/boost/boost_1_67_0
-- Include Directories
       C:/Program1/boost/boost_1_67_0/
-- Library Directories
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1
-- Libraries
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_system-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_system-vc141-mt-gd-x64-1_67.lib
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_thread-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_thread-vc141-mt-gd-x64-1_67.lib
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_random-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_random-vc141-mt-gd-x64-1_67.lib
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_chrono-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_chrono-vc141-mt-gd-x64-1_67.lib
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_date_time-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_date_time-vc141-mt-gd-x64-1_67.lib
       optimized
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_atomic-vc141-mt-x64-1_67.lib
       debug
       C:/Program1/boost/boost_1_67_0/lib64-msvc-14.1/boost_atomic-vc141-mt-gd-x64-1_67.lib

** websocketpp
** associative_storage
-- Build Type:
       EXECUTABLE
** broadcast_server
-- Build Type:
       EXECUTABLE
** debug_client
-- Build Type:
       EXECUTABLE
** debug_server
-- Build Type:
       EXECUTABLE
** echo_client
-- Build Type:
       EXECUTABLE
** echo_server
-- Build Type:
       EXECUTABLE
** echo_server_both
-- Build Type:
       EXECUTABLE
** echo_server_tls
-- Build Type:
       EXECUTABLE
** enriched_storage
-- Build Type:
       EXECUTABLE
** external_io_service
-- Build Type:
       EXECUTABLE
** handler_switch
-- Build Type:
       EXECUTABLE
** iostream_server
-- Build Type:
       EXECUTABLE
** print_client
-- Build Type:
       EXECUTABLE
** print_client_tls
-- Build Type:
       EXECUTABLE
** print_server
-- Build Type:
       EXECUTABLE
** simple_broadcast_server
-- Build Type:
       EXECUTABLE
** sip_client
-- Build Type:
       EXECUTABLE
** subprotocol_server
-- Build Type:
       EXECUTABLE
** telemetry_client
-- Build Type:
       EXECUTABLE
** telemetry_server
-- Build Type:
       EXECUTABLE
** testee_client
-- Build Type:
       EXECUTABLE
** testee_server
-- Build Type:
       EXECUTABLE
** utility_client
-- Build Type:
       EXECUTABLE

=========== Used Build Configuration =============

ENABLE_CPP11        = ON
BUILD_EXAMPLES      = ON
BUILD_TESTS         = OFF

WEBSOCKETPP_ROOT    = D:/third-party-software/websocketpp
WEBSOCKETPP_BIN     = D:/third-party-software/websocketpp/build/bin
WEBSOCKETPP_LIB     = D:/third-party-software/websocketpp/build/lib
Install prefix      = D:/third-party-software/websocketpp/install

WEBSOCKETPP_BOOST_LIBS        = system;thread;random
WEBSOCKETPP_PLATFORM_LIBS     = 
WEBSOCKETPP_PLATFORM_TLS_LIBS = 

OPENSSL_FOUND        = TRUE
OPENSSL_INCLUDE_DIR     = C:/Program1/GDAL/release-1911-x64-dev/release-1911-x64/include
OPENSSL_LIBRARIES = C:/Program1/GDAL/release-1911-x64-dev/release-1911-x64/lib/ssleay32.lib;C:/Program1/GDAL/release-1911-x64-dev/release-1911-x64/lib/libeay32.lib
OPENSSL_VERSION = 1.0.1h

Configuring done

I the press Generate, which creates the Visual Studio solution, and Open Project, which opens the solution in Visual Studio 2017.

(I don't know what commands pressing each of these buttons would correspond to in the terminal.)

In Visual Studio, I right-click on the target INSTALL and click Build, and do that twice (to get rid of a lot of superfluous output). This results in the following output the second time I do it:

1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
2>------ Build started: Project: debug_server, Configuration: Release x64 ------
3>------ Build started: Project: iostream_server, Configuration: Release x64 ------
4>------ Build started: Project: print_client_tls, Configuration: Release x64 ------
2>cl : Command line warning D9002: ignoring unknown option '/arch:SSE2'
2>debug_server.cpp
4>cl : Command line warning D9002: ignoring unknown option '/arch:SSE2'
4>print_client_tls.cpp
3>iostream_server.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
3>iostream_server.obj : error LNK2001: unresolved external symbol __imp_htons
3>iostream_server.obj : error LNK2001: unresolved external symbol __imp_htonl
3>iostream_server.obj : error LNK2001: unresolved external symbol __imp_ntohs
3>D:\third-party-software\websocketpp\build\bin\Release\iostream_server.exe : fatal error LNK1120: 3 unresolved externals
3>Done building project "iostream_server.vcxproj" -- FAILED.
2>D:\third-party-software\websocketpp\websocketpp/frame.hpp(834): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data
4>D:\third-party-software\websocketpp\websocketpp/frame.hpp(834): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data
2>D:\third-party-software\websocketpp\websocketpp/logger/syslog.hpp(34): fatal error C1083: Cannot open include file: 'syslog.h': No such file or directory
4>D:\third-party-software\websocketpp\websocketpp/common/md5.hpp(367): warning C4267: '+=': conversion from 'size_t' to 'websocketpp::md5::md5_word_t', possible loss of data
4>D:\third-party-software\websocketpp\websocketpp/sha1/sha1.hpp(176): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
4>D:\third-party-software\websocketpp\examples\print_client_tls\print_client_tls.cpp(71): error C3861: 'strcasecmp': identifier not found
4>D:\third-party-software\websocketpp\examples\print_client_tls\print_client_tls.cpp(106): error C3861: 'strcasecmp': identifier not found
2>Done building project "debug_server.vcxproj" -- FAILED.
4>Done building project "print_client_tls.vcxproj" -- FAILED.
5>------ Build started: Project: ALL_BUILD, Configuration: Release x64 ------
6>------ Build started: Project: INSTALL, Configuration: Release x64 ------
6>-- Install configuration: "Release"
6>-- Up-to-date: D:/third-party-software/websocketpp/install/cmake/websocketpp-config.cmake
6>-- Up-to-date: D:/third-party-software/websocketpp/install/cmake/websocketpp-configVersion.cmake
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/base64
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/base64/base64.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/client.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/close.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/asio.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/asio_ssl.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/chrono.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/connection_hdl.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/cpp11.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/functional.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/md5.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/memory.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/network.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/platforms.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/random.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/regex.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/stdint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/system_error.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/thread.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/time.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/common/type_traits.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/concurrency
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/concurrency/basic.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/concurrency/none.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/asio.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/asio_client.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/asio_no_tls.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/asio_no_tls_client.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/boost_config.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/core.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/core_client.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/debug.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/debug_asio.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/debug_asio_no_tls.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/minimal_client.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/config/minimal_server.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/connection_base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/endpoint_base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/error.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/extensions
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/extensions/extension.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/extensions/permessage_deflate
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/extensions/permessage_deflate/disabled.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/extensions/permessage_deflate/enabled.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/frame.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/constants.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/impl
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/impl/parser.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/impl/request.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/impl/response.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/parser.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/request.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/http/response.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/impl
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/impl/connection_impl.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/impl/endpoint_impl.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/impl/utilities_impl.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/logger
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/logger/basic.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/logger/levels.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/logger/stub.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/logger/syslog.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/message_buffer
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/message_buffer/alloc.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/message_buffer/message.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/message_buffer/pool.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/hybi00.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/hybi07.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/hybi08.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/hybi13.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/processors/processor.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/random
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/random/none.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/random/random_device.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/roles
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/roles/client_endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/roles/server_endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/server.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/sha1
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/sha1/sha1.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/security
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/security/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/security/none.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/asio/security/tls.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/base
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/base/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/base/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/debug
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/debug/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/debug/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/debug/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/iostream
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/iostream/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/iostream/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/iostream/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/stub
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/stub/base.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/stub/connection.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/transport/stub/endpoint.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/uri.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/utf8_validator.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/utilities.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/include//websocketpp/version.hpp
6>-- Up-to-date: D:/third-party-software/websocketpp/install/bin/associative_storage.exe
6>-- Up-to-date: D:/third-party-software/websocketpp/install/bin/broadcast_server.exe
6>-- Up-to-date: D:/third-party-software/websocketpp/install/bin/debug_client.exe
6>CMake Error at examples/debug_server/cmake_install.cmake:37 (file):
6>  file INSTALL cannot find
6>  "D:/third-party-software/websocketpp/build/bin/Release/debug_server.exe".
6>Call Stack (most recent call first):
6>  cmake_install.cmake:56 (include)
6>
6>
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: The command "setlocal
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmEnd
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmErrorLevel
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: exit /b %1
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmDone
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd" exited with code 1.
6>Done building project "INSTALL.vcxproj" -- FAILED.
========== Build: 2 succeeded, 4 failed, 20 up-to-date, 0 skipped ==========

It seems like the linker is looking for the symbols __imp_htons, __imp_htonl and __imp_ntohs but cannot find them. How do I fix this?

2条回答
不美不萌又怎样
2楼-- · 2019-08-10 20:06

As it is too much for a comment I put it as an answer here.

You downloaded the project and extracted it from zip. Say to directory D:\third-party-software\websocketpp.

Remove any build artifacts before trying the following recipe, i.e. delete the build folder.

Open a console window. From the command line change to the parent directory

cd D:\third-party-software\websocketpp
cmake -H. -Bbuild -G "Visual Studio 15 2017 Win64" -DBUILD_EXAMPLES=ON -DBOOST_ROOT=C:/Program1/boost/boost_1_67_0
cmake --build build --target ALL_BUILD --config Release

That should build the entire project out of the box including the examples. If you rather like to work with Visual Studio you can easily open the generated solution file *.sln that is generated to the build folder.

This should build websocketpp first and then the examples. If that does not happen it's a problem with websocketpp, but I really don't think that.

查看更多
一夜七次
3楼-- · 2019-08-10 20:21

If you have Boost 1.67 it comes with WebSockets already, you don't need websocketpp: https://www.boost.org/doc/libs/1_69_0/libs/beast/doc/html/index.html

查看更多
登录 后发表回答