window编译出现boost throw exception

本文档介绍了如何处理C++中两个常见问题:链接时找不到boost::throw_exception函数的解决方案,以及在启用异常禁用时抛出异常的报错。第二个问题是关于int64_t和std::numeric_limits<int32_t>比较引发的,通过启用pdb编译和预定义NOMINMAX宏来解决。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

报错:

error LNK2019: 无法解析的外部符号 "void __cdecl boost::throw_exception(class std::exception const &)" (?throw_exception@boost@@YAXAEBVexception@std@@@Z),该符号在函数 "void __cdecl boost::asio::detail::do_throw_error(class boost::system::error_code const &,char const *)" (?do_throw_error@detail@asio@boost@@YAXAEBVerror_code@system@3@PEBD@Z) 中被引用

解决办法:

(2条消息) 解决:error LNK2019: 无法解析的外部符号 “void __cdecl boost::throw_exception(class std::exception const &)“_难搞哦~的博客-CSDN博客_无法解析外部符号void_cdecl

2022.10.4更新

使用MVSC clang编译 ndt-omp报错:Error: cannot use 'throw' with exceptions disabled。

解决办法: 同上,也是在【代码生成】加上EHsc,参考:Cannot use 'throw' with exceptions disable · Issue #289 · Sarcasm/irony-mode (github.com)

报错:comparison between pointer and integer ('long long' and 'int (*)() noexcept') 

描述:指向std::numeric_limits<int32_t>::max(),看代码是因为int64_t类型的数据在和std::numeric_limits<int32_t>::max()做对比,以为因为这样会报这样的错,把int32_t改为int64_t发现还是不可以。

解决办法:启用pdb编译就报错,不启动则不报问题了

终极解决办法:增加NOMINMAX的预定义

warning C4003: not enough arguments for function-like macro invocation 'max' · Issue #479 · microsoft/cppwinrt (github.com)

c++ - macro and member function conflict - Stack Overflow

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值