本文介绍了什么是 __CxxFrameHandler4 以及链接器错误“未解析的外部符号 __CxxFrameHandler4"是什么?是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用几个通过 vcpkg 构建的库(例如 civet-web 和 prometheus-cpp),用于我的 Visual C++ 项目.当构建 x86 一切都完美时,在 x64 中我收到一堆链接器错误:

I'm using several libraries built through vcpkg (such as civet-web and prometheus-cpp), against my Visual C++ projects. When building x86 all is perfect, in x64 I get a bunch of linker errors:

错误 LNK2001:未解析的外部符号 __CxxFrameHandler4

在线搜索此符号/错误的所有引用都与特定项目有关,我找不到 __CxxFrameHandler4 是什么 以及此错误突出显示了什么问题.我不知道是 vcpkg 构建库的方式有问题,还是我的项目有问题,或者如何开始寻找解决方案.

Searching online all references to this symbol/error are about specific projects, I cannot find what __CxxFrameHandler4 is and what problem this error is highlighting. I don't know if it's a problem with the way vcpkg is building the library, or a problem in my project or how to start looking for a solution.

我确实找到了这篇博客文章,但它参考了 VS2019 的预览,我找不到与之相关的任何设置:https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/

I did find this blog article but it is in reference to a preview of VS2019, I cannot find any settings related to it: https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/

如果有人能解释这一切,那将是一个很大的帮助.

If anyone can explain what this is all about it would be a big help.

推荐答案

我在尝试通过 vcpkg 安装和使用 cpr 时遇到了同样的问题.我想在 VS2015 项目中使用 cpr 库.

原因:我安装了 VS2019.vcpkg 使用最新版本的 Visual Studio 工具集.
解决方案:添加您自己的三元组或更改现有的方式以使用您指定的工具集.添加在我的情况下不起作用,因此我更改了现有的三元组"vcpkg 中三元组文件夹中的文件.我想让 vcpkg 使用 VS2015 (It's V140) 附带的工具集

I faced the same issues when trying to install and use cpr with vcpkg. I wanted to use cpr library in a VS2015 project.

Reason: I had VS2019 installed. vcpkg uses latest version of toolset Visual Studio.
Resolution: Add your own triplet or change existing such a way that your specified toolset is used. Adding did not work in my case so I changed existing "triplet" files in triplet folder in vcpkg. I wanted vcpkg to use toolset that comes with VS2015 (It's V140)

x86-windows.cmake 文件的内容

set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET "v140")
set(VCPKG_DEP_INFO_OVERRIDE_VARS "v140")

x64-windows.cmake 文件的内容

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET "v140")
set(VCPKG_DEP_INFO_OVERRIDE_VARS "v140")

这篇关于什么是 __CxxFrameHandler4 以及链接器错误“未解析的外部符号 __CxxFrameHandler4"是什么?是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 12:18