Boost Asio编译库会出错

时间:2015-07-23 02:49:09

标签: c++ boost-asio

我在Netbeans开始了一个非常简单的c ++项目。

#include <boost/asio.hpp>
#include <cstdlib>

using namespace std;

/*
 * 
 */
 int main(int argc, char** argv) {

   return 0;
}

一旦我尝试编译,我会在boost asio文件中收到大量错误。

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'
rm -f -r build/Debug
rm -f dist/Debug/Cygwin_1-Windows/cppapplication_2.exe
make[1]: Leaving directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'

CLEAN SUCCESSFUL (total time: 4s)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_1-Windows/cppapplication_2.exe
make[2]: Entering directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'
mkdir -p build/Debug/Cygwin_1-Windows
rm -f "build/Debug/Cygwin_1-Windows/main.o.d"
g++    -c -g -I/cygdrive/E/Programming/c++\ libraries/Boost/boost_1_58_0 -MMD -MP -MF "build/Debug/Cygwin_1-Windows/main.o.d" -o build/Debug/Cygwin_1-Windows/main.o main.cpp
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/async_result.hpp:18:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:20,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/config.hpp:551:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
 #   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
     ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/config.hpp:552:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
 #   warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
     ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/config.hpp:553:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
 #   warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
     ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/config.hpp:577:5: error: #error You must add -D__USE_W32_SOCKETS to your compiler options.
 #   error You must add -D__USE_W32_SOCKETS to your compiler options.
     ^
In file included from /usr/include/w32api/winsock2.h:56:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/socket_types.hpp:38,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:22,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/winsock_init.hpp:125,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:28,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/usr/include/w32api/psdk_inc/_fd_types.h:100:2: warning: #warning "fd_set and associated macros have been defined in sys/types.      This can cause runtime problems with W32 sockets" [-Wcpp]
 #warning "fd_set and associated macros have been defined in sys/types.  \
  ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/posix_tss_ptr.ipp:24:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/posix_tss_ptr.hpp:76,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/tss_ptr.hpp:27,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/call_stack.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/impl/handler_alloc_hook.ipp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/handler_alloc_hook.hpp:80,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/handler_alloc_helpers.hpp:21,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/bind_handler.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/wrapped_handler.hpp:18,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:24,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:87:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_BROKEN_PIPE),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:87:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_BROKEN_PIPE),
       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:140:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_OUTOFMEMORY),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:140:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_OUTOFMEMORY),
       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:145:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_ACCESS_DENIED),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:145:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_ACCESS_DENIED),
       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:153:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_BAD_UNIT),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:153:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_BAD_UNIT),
       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:164:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_OPERATION_ABORTED),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:164:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_OPERATION_ABORTED),
       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:178:31: error: a function call cannot appear in a constant-expression
       BOOST_ASIO_NATIVE_ERROR(ERROR_RETRY),
                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:53:50: note: in definition of macro 'BOOST_ASIO_WIN_OR_POSIX'
 # define BOOST_ASIO_WIN_OR_POSIX(e_win, e_posix) e_win
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/error.hpp:178:7: note: in expansion of macro 'BOOST_ASIO_NATIVE_ERROR'
       BOOST_ASIO_NATIVE_ERROR(ERROR_RETRY),
       ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/socket_types.hpp:38:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:22,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/winsock_init.hpp:125,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:28,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/usr/include/w32api/winsock2.h:1004:68: error: conflicting declaration of C function 'int gethostname(char*, int)'
   WINSOCK_API_LINKAGE int WSAAPI gethostname(char *name,int namelen);
                                                                    ^
In file included from /usr/include/sys/unistd.h:8:0,
                 from /usr/include/unistd.h:4,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/config/stdlib/libstdcpp3.hpp:78,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/config.hpp:48,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/config.hpp:26,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/async_result.hpp:18,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:20,
                 from main.cpp:8:
/usr/include/sys/unistd.h:249:6: note: previous declaration 'int gethostname(char*, size_t)'
  int _EXFUN(gethostname, (char *__name, size_t __len));
      ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/winsock_init.hpp:125:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:28,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp: In static member function 'static void boost::asio::detail::winsock_init_base::startup(boost::asio::detail::winsock_init_base::data&, unsigned char, unsigned char)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:36:44: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedIncrement(volatile int*)'
   if (::InterlockedIncrement(&d.init_count_) == 1)
                                            ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:40:45: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
     ::InterlockedExchange(&d.result_, result);
                                             ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp: In static member function 'static void boost::asio::detail::winsock_init_base::manual_startup(boost::asio::detail::winsock_init_base::data&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:46:44: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedIncrement(volatile int*)'
   if (::InterlockedIncrement(&d.init_count_) == 1)
                                            ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:48:40: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
     ::InterlockedExchange(&d.result_, 0);
                                        ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp: In static member function 'static void boost::asio::detail::winsock_init_base::cleanup(boost::asio::detail::winsock_init_base::data&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:54:44: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
   if (::InterlockedDecrement(&d.init_count_) == 0)
                                            ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp: In static member function 'static void boost::asio::detail::winsock_init_base::manual_cleanup(boost::asio::detail::winsock_init_base::data&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:62:40: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
   ::InterlockedDecrement(&d.init_count_);
                                        ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp: In static member function 'static void boost::asio::detail::winsock_init_base::throw_on_error(boost::asio::detail::winsock_init_base::data&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/winsock_init.ipp:67:55: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
   long result = ::InterlockedExchangeAdd(&d.result_, 0);
                                                       ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/impl/io_service.hpp:69:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:767,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp: In member function 'bool boost::asio::detail::win_iocp_io_service::stopped() const':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:84:49: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
     return ::InterlockedExchangeAdd(&stopped_, 0) != 0;
                                                 ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp: In member function 'void boost::asio::detail::win_iocp_io_service::reset()':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:90:39: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
     ::InterlockedExchange(&stopped_, 0);
                                       ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp: In member function 'void boost::asio::detail::win_iocp_io_service::work_started()':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:96:46: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedIncrement(volatile int*)'
     ::InterlockedIncrement(&outstanding_work_);
                                              ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp: In member function 'void boost::asio::detail::win_iocp_io_service::work_finished()':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:102:50: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
     if (::InterlockedDecrement(&outstanding_work_) == 0)
                                                  ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:310:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/impl/io_service.hpp:69,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:767,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.hpp: In member function 'void boost::asio::detail::win_iocp_io_service::schedule_timer(boost::asio::detail::timer_queue<Time_Traits>&, const typename Time_Traits::time_type&, typename boost::asio::detail::timer_queue<Time_Traits>::per_timer_data&, boost::asio::detail::wait_op*)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.hpp:94:45: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
   if (::InterlockedExchangeAdd(&shutdown_, 0) != 0)
                                             ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.hpp: In member function 'std::size_t boost::asio::detail::win_iocp_io_service::cancel_timer(boost::asio::detail::timer_queue<Time_Traits>&, typename boost::asio::detail::timer_queue<Time_Traits>::per_timer_data&, std::size_t)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.hpp:114:45: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
   if (::InterlockedExchangeAdd(&shutdown_, 0) != 0)
                                             ^
In file included from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/win_iocp_io_service.hpp:312:0,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/impl/io_service.hpp:69,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/io_service.hpp:767,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_io_object.hpp:19,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/basic_datagram_socket.hpp:20,
                 from /cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio.hpp:21,
                 from main.cpp:8:
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::timer_thread_function::operator()()':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:51:63: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
     while (::InterlockedExchangeAdd(&io_service_->shutdown_, 0) == 0)
                                                               ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:56:66: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
         ::InterlockedExchange(&io_service_->dispatch_required_, 1);
                                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'virtual void boost::asio::detail::win_iocp_io_service::shutdown_service()':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:93:38: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
   ::InterlockedExchange(&shutdown_, 1);
                                      ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:102:56: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchangeAdd(volatile int*, int)'
   while (::InterlockedExchangeAdd(&outstanding_work_, 0) > 0)
                                                        ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:112:50: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
         ::InterlockedDecrement(&outstanding_work_);
                                                  ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:125:50: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
         ::InterlockedDecrement(&outstanding_work_);
                                                  ^
                                                ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::post_deferred_completions(boost::asio::detail::op_queue<boost::asio::detail::win_iocp_operation>&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:268:51: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
       ::InterlockedExchange(&dispatch_required_, 1);
                                                   ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::abandon_operations(boost::asio::detail::op_queue<boost::asio::detail::win_iocp_operation>&)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:279:46: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedDecrement(volatile int*)'
     ::InterlockedDecrement(&outstanding_work_);
                                              ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::on_pending(boost::asio::detail::win_iocp_operation*)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:286:53: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedCompareExchange(volatile int*, int, int)'
   if (::InterlockedCompareExchange(&op->ready_, 1, 0) == 1)
                                                     ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:295:51: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
       ::InterlockedExchange(&dispatch_required_, 1);
                                                   ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::on_completion(boost::asio::detail::win_iocp_operation*, DWORD, DWORD)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:319:49: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
     ::InterlockedExchange(&dispatch_required_, 1);
                                                 ^
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp: In member function 'void boost::asio::detail::win_iocp_io_service::on_completion(boost::asio::detail::win_iocp_operation*, const boost::system::error_code&, DWORD)':
/cygdrive/E/Programming/c++ libraries/Boost/boost_1_58_0/boost/asio/detail/impl/win_iocp_io_service.ipp:341:49: error: cannot convert 'long int*' to 'volatile int*' for argument '1' to 'int _InterlockedExchange(volatile int*, int)'
     ::InterlockedExchange(&dispatch_required_, 1);
                                                 ^
               ^

/usr/include/w32api/winsock2.h:995:34: note: previous declaration 'int select(int, _types_fd_set*, _types_fd_set*, _types_fd_set*, PTIMEVAL)'
   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
                                  ^
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/Cygwin_1-Windows/main.o' failed
make[2]: *** [build/Debug/Cygwin_1-Windows/main.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Justin/Documents/NetBeansProjects/CppApplication_2'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 7s)

已经有一段时间了。希望有人可以提供帮助。

1 个答案:

答案 0 :(得分:1)

作为你的代码,我通过了编译和运行

我的编译是这样的: g ++ test.cpp -I / home / develop / boost_1_57_0 / -L / home / develop / boost_1_57_0 / stage / lib / -l boost_system