gpt4 book ai didi

c++ - 在 C++ Builder 2010 上包含 boost/asio.hpp 时出现编译器错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:58:42 28 4
gpt4 key购买 nike

编辑:已解决!

我将 BOOST_ALL_NO_LIB 添加到我的条件定义中,并将/libs/system/src/文件夹中的 errorcode.cpp 添加到我的项目中。


我最近设置了 C++ Builder 并一直在使用它来了解 C++。

我需要为我将要处理的项目使用 boost-asio,但在尝试包含和编译它时遇到了一些问题。我已经设置了项目包含路径和所有应有的内容(我可以通过删除它进行测试,编译器提示它找不到 asio.hpp,这不是问题所在)。

我尝试了 2 个版本的 Boost,1_39 和 1_46,根据使用的版本,我得到了不同的错误。

我想忽略初学者的警告。另外,如果您想要错误中的完整解析器上下文,请告诉我,我可以发布它们。

1_39:

[BCC32 Warning] error_code.hpp(486): W8104 Local Static with constructor dangerous for multi-threaded apps

[BCC32 Warning] error.hpp(349): W8104 Local Static with constructor dangerous for multi-threaded apps

[BCC32 Error] auto_link.hpp(262): E2075 Incorrect pragma directive option: -v

[BCC32 Error] static_log2.hpp(51): E2451 Undefined symbol 'n'

[BCC32 Error] static_log2.hpp(55): E2451 Undefined symbol 'value'

[BCC32 Error] static_log2.hpp(55): E2230 In-line data member initialization requires an integral constant expression

[BCC32 Fatal Error] static_log2.hpp(49): F1004 Internal compiler error at 0x55a4e8d with base 0x5500000

1_46:

[BCC32 Warning] xutility(1808): W8017 Redefinition of 'NOMINMAX' is not identical

[BCC32 Warning] stdint.h(168): W8017 Redefinition of 'WCHAR_MAX' is not identical

[BCC32 Warning] win_tss_ptr.ipp(41): W8012 Comparing signed and unsigned values

[BCC32 Warning] socket_select_interrupter.ipp(138): W8012 Comparing signed and unsigned values

[BCC32 Error] strand_service.hpp(31): E2247 'strand_service::do_complete(win_iocp_io_service *,win_iocp_operation *,system::error_code,unsigned int)' is not accessible

[BCC32 Warning] strand_service.ipp(95): W8058 Cannot create pre-compiled header: initialized data in header

源代码并不重要,但无论如何(删除 asio include,显然我没有问题):

//---------------------------------------------------------------------------
#include <boost/asio.hpp>
#include <iostream>
//---------------------------------------------------------------------------

int main ()
{
std::cout << "Test";
std::cin.ignore();
return 0;
}
//---------------------------------------------------------------------------

编辑:已解决!

我将 BOOST_ALL_NO_LIB 添加到我的条件定义中,并将/libs/system/src/文件夹中的 errorcode.cpp 添加到我的项目中。

最佳答案

根据编辑解决:

我将 BOOST_ALL_NO_LIB 添加到我的条件定义中,并将/libs/system/src/文件夹中的 errorcode.cpp 添加到我的项目中。

关于c++ - 在 C++ Builder 2010 上包含 boost/asio.hpp 时出现编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5830768/

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