This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: Cygwin 2.876 64bit - Boost 1.60 asio does not compile
- From: Tommaso Fabbri <t dot fabbri at yahoo dot com>
- To: cygwin-apps at cygwin dot com
- Cc: Yaakov Selkowitz <yselkowitz at cygwin dot com>
- Date: Mon, 10 Oct 2016 13:03:00 +0200
- Subject: Re: Cygwin 2.876 64bit - Boost 1.60 asio does not compile
- Authentication-results: sourceware.org; auth=none
- References: <00f501d220ae$29998150$7ccc83f0$@yahoo.com> <9cc3fd51-aed1-7b3a-bf69-ee4a64867f83@cygwin.com>
> Il giorno 08/ott/2016, alle ore 00:55, Yaakov Selkowitz <yselkowitz@cygwin.com> ha scritto:
>
> On 2016-10-07 10:19, Tommaso Fabbri wrote:
>> I have a Windows 10 system running the latest version of Cygwin 64 bit.
>> I’ve installed all the Boost libraries and cmake, make packages to develop
>> under Windows like on *nix systems.
>> When I try to compile a simple application including the boost-asio library
>> like the following, it fails.
>>
>> #include <boost/asio.hpp>
>> int main(int argc, char**argv)
>> {
>> return 0;
>> }
>
> WFM, but then again you didn't tell us *how* were trying to compile it until...
>
>> I report the stackoverflow discussion link:
>> http://stackoverflow.com/questions/39894006/how-to-use-boost-asio-library-with-cygwin-64-bit
Sorry for the missing parts. I attach here the cmakelists I used at the beginning:
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(Boost REQUIRED COMPONENTS system)
add_executable(Test test_asio.cpp )
INCLUDE_DIRECTORIES ( ${Boost_INCLUDE_DIR} )
INCLUDE_DIRECTORIES ( /usr/include )
INCLUDE_DIRECTORIES ( ./ )
target_link_libraries(Test ${Boost_SYSTEM_LIBRARY})
Then I tried to add all the things found in discussions on the internet (__USE_W32_SOCKETS …), included the one I linked in the past mail.
>
> Which shows you're making several mistakes:
>
> * -std=c++11; use -std=gnu++11 instead;
I have to include the following change
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
>
> * -D__USE_W32_SOCKETS; winsock cannot be combined with Cygwin's *NIX socket APIs, so do NOT define this. If you want a pure Windows build of this code without the Cygwin dependency, then use mingw64-*-boost with the mingw64 toolchains (and also link with -lws2_32);
I install mingw64 and I see what happens by adding -lws2_32.
>
> * not linking with -lboost_system;
target_link_libraries(Test ${Boost_SYSTEM_LIBRARY})
>
> * attempting to get authoritative answers outside of this list.
Anyway, I am not the author of the question on stackoverflow.com :)
>
>
> --
> Yaakov