编译升压例如项目Cygwin的GCC + [英] Compiling Boost example projects with Cygwin + gcc
本文介绍了编译升压例如项目Cygwin的GCC +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
虽然试图编译升压ASIO示例项目
async_tcp_echo_server.cpp
我得到像下面这样的错误:
__ MSABI_LONG在这个文件范围内未声明
BOOST_ASIO_NATIVE_ERROR(ERROR_BROKEN_PIPE)__MSABI_LONG没有在这个文件范围内声明
BOOST_ASIO_NATIVE_ERROR(ERROR_OPERATION中止)
这是与升压1.55.0和gcc版本4.8.3
提升了使用GCC编译和下面的命令
./ bootstrap.sh
./b2 CXXFLAGS = - D__USE_W32_SOCKETS -D_WIN32_WINNT = 0x0501
./b2安装
我试图编译示例项目
GCC -std = C ++ 11 -D__USE_W32_SOCKETS -D_WIN32_WINNT = 0x0501 -I C:\\ boost_1_55_0 C:\\ boost_1_55_0 \\提升\\ asio.hpp async_tcp_echo_server.cpp
解决方案
从Cygwin的设置对我没有帮助1_57版本,它给了我 FD_SET错误
。
这就是我试图使升压例如code的工作:
- 添加
的#define __MSABI_LONG(x)x
上方。 - 寒冷,我知道:) - 这些标记添加到
G ++
:-D_WIN32_WINNT = 0x0501 -D__USE_W32_SOCKETS -std = C ++ 11 -lboost_system -lws2_32
瞧!
While trying to compile the boost asio example project async_tcp_echo_server.cpp
I get errors like the following:
__MSABI_LONG was not declared in this file scope
BOOST_ASIO_NATIVE_ERROR(ERROR_BROKEN_PIPE)
__MSABI_LONG was not declared in this file scope
BOOST_ASIO_NATIVE_ERROR(ERROR_OPERATION ABORTED)
This is with Boost 1.55.0 and gcc version 4.8.3
boost was compiled with gcc and the following commands
./bootstrap.sh
./b2 cxxflags="-D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501
./b2 install
I attempted to compile the sample project with
gcc -std=C++11 -D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501 -I C:\boost_1_55_0 C:\boost_1_55_0\boost\asio.hpp async_tcp_echo_server.cpp
解决方案
1_57 version from cygwin setup doesn't help for me, it gives me fd_set errors
.
This is what I tried to make the boost example code work:
- add
#define __MSABI_LONG(x) x
at the top. - chilly, I know :) - add these flags to
g++
:-D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS -std=c++11 -lboost_system -lws2_32
Voila!
这篇关于编译升压例如项目Cygwin的GCC +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文