gpt4 book ai didi

c++ - boost asio netbeans错误

转载 作者:搜寻专家 更新时间:2023-10-31 01:07:51 26 4
gpt4 key购买 nike

我正在运行一个简单的 example而且我无法编译代码。

我在 Windows 7 机器上使用 minGW、netbeans 和 boost。

起初我得到:

g++    -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
main.cpp:12:26: fatal error: boost/asio.hpp: No such file or directory
#include <boost/asio.hpp>

所以,我猜是一个链接错误。为了解决这个问题,我复制了

C:\boost\boost_1_54_0\boost

C:\MinGW\include\boost

我怀疑这是对的,但现在我得到以下错误:

g++    -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::move_construct(boost::asio::detail::win_object_handle_service::implementation_type&, boost::asio::detail::win_object_handle_service::implementation_type&)':
In file included from c:\mingw\include\boost\asio\detail\win_object_handle_service.hpp:180:0,
from c:\mingw\include\boost\asio\windows\object_handle_service.hpp:25,
from c:\mingw\include\boost\asio\windows\basic_object_handle.hpp:27,
from c:\mingw\include\boost\asio.hpp:108,
from main.cpp:12:
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:106:5: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE);
^
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::move_assign(boost::asio::detail::win_object_handle_service::implementation_type&, boost::asio::detail::win_object_handle_service&, boost::asio::detail::win_object_handle_service::implementation_type&)':
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:158:5: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE);
^
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::destroy(boost::asio::detail::win_object_handle_service::implementation_type&)':
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:200:7: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE);
^
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In member function 'boost::system::error_code boost::asio::detail::win_object_handle_service::close(boost::asio::detail::win_object_handle_service::implementation_type&, boost::system::error_code&)':
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:251:7: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE);
^
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In member function 'boost::system::error_code boost::asio::detail::win_object_handle_service::cancel(boost::asio::detail::win_object_handle_service::implementation_type&, boost::system::error_code&)':
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:302:7: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE);
^
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp: In static member function 'static void boost::asio::detail::win_object_handle_service::wait_callback(PVOID, BOOLEAN)':
c:\mingw\include\boost\asio\detail\impl\win_object_handle_service.ipp:402:5: error: '::UnregisterWaitEx' has not been declared
::UnregisterWaitEx(impl->wait_handle_, NULL);
^
make.exe[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make.exe[2]: Leaving directory `/c/Users/Jeff/Documents/NetBeansProjects/CppApplication_2'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Jeff/Documents/NetBeansProjects/CppApplication_2'
make.exe": *** [.build-impl] Error 2


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

最佳答案

尝试在你的命令行中输入

-D_WIN32_WINNT=0x0601 -DWINVER=0x0601

-D_WIN32_WINNT=0x0501 -DWINVER=0x0501

Windows versions

关于c++ - boost asio netbeans错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18793605/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com