如何在Cygwin 64位上使用boost asio库 [英] How to use boost asio library with Cygwin 64 bit
本文介绍了如何在Cygwin 64位上使用boost asio库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行Windows 10 64位. Cygwin是64位.
I am running Windows 10 64bit. Cygwin is 64 bit.
我从cygwin软件包管理器安装了boost.
I installed boost from cygwin package manager.
我试图编译test.cpp:
I tried to compile test.cpp:
#include <boost/asio.hpp>
int
main(int argc, char**argv)
{
return 0;
}
使用命令
g++ -std=c++11 -Wall -g -D__USE_W32_SOCKETS D_WIN32_WINNT=_WIN32_WINNT_WIN7 test.cpp -o test.exe
但是编译失败. 似乎正在使用posix .
任何想法为何失败?
In file included from /usr/include/boost/asio/detail/fd_set_adapter.hpp:22:0,
from /usr/include/boost/asio/detail/select_reactor.hpp:27,
from /usr/include/boost/asio/detail/reactor.hpp:29,
from /usr/include/boost/asio/detail/impl/task_io_service.ipp:24,
from /usr/include/boost/asio/detail/task_io_service.hpp:198,
from /usr/include/boost/asio/impl/io_service.hpp:71,
from /usr/include/boost/asio/io_service.hpp:767,
from /usr/include/boost/asio/basic_io_object.hpp:19,
from /usr/include/boost/asio/basic_socket.hpp:20,
from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
from /usr/include/boost/asio.hpp:21,
from appcontrol.cpp:16:
/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:82:12: error: 'fd_set' does not name a type
operator fd_set*()
^
/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:105:11: error: 'fd_set' does not name a type
mutable fd_set fd_set_;
^
/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp: In constructor 'boost::asio::detail::posix_fd_set_adapter::posix_fd_set_adapter()':
/usr/include/boost/asio/detail/posix_fd_set_adapter.hpp:42:14: error: 'fd_set_' was not declared in this scope
FD_ZERO(&fd_set_);
^
推荐答案
感谢#cygwin IRC的帮助:
Thanks to help from #cygwin IRC:
g++ -std=c++11 -Wall -g -D_XOPEN_SOURCE=500 test.cpp -o test.exe -lboost_system
这篇关于如何在Cygwin 64位上使用boost asio库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文