public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* Cygwin 2.876 64bit - Boost 1.60 asio does not compile
@ 2016-10-07 15:22 Tommaso Fabbri
  2016-10-07 22:55 ` Yaakov Selkowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Tommaso Fabbri @ 2016-10-07 15:22 UTC (permalink / raw)
  To: cygwin-apps

Good evening, 

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;
}

I report the stackoverflow discussion link:
http://stackoverflow.com/questions/39894006/how-to-use-boost-asio-library-wi
th-cygwin-64-bit
Thank you so much. 

Tommaso Fabbri

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cygwin 2.876 64bit - Boost 1.60 asio does not compile
  2016-10-07 15:22 Cygwin 2.876 64bit - Boost 1.60 asio does not compile Tommaso Fabbri
@ 2016-10-07 22:55 ` Yaakov Selkowitz
  2016-10-10 11:03   ` Tommaso Fabbri
  0 siblings, 1 reply; 3+ messages in thread
From: Yaakov Selkowitz @ 2016-10-07 22:55 UTC (permalink / raw)
  To: cygwin-apps

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

Which shows you're making several mistakes:

* -std=c++11; use -std=gnu++11 instead;

* -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);

* not linking with -lboost_system;

* attempting to get authoritative answers outside of this list.


-- 
Yaakov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cygwin 2.876 64bit - Boost 1.60 asio does not compile
  2016-10-07 22:55 ` Yaakov Selkowitz
@ 2016-10-10 11:03   ` Tommaso Fabbri
  0 siblings, 0 replies; 3+ messages in thread
From: Tommaso Fabbri @ 2016-10-10 11:03 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Yaakov Selkowitz


> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-10 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 15:22 Cygwin 2.876 64bit - Boost 1.60 asio does not compile Tommaso Fabbri
2016-10-07 22:55 ` Yaakov Selkowitz
2016-10-10 11:03   ` Tommaso Fabbri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).