代码执行无法继续,因为找不到cpprest_2_10.dll

code execution cannot proceed because cpprest_2_10.dll was not found

提问人:johnny9876 提问时间:7/24/2018 更新时间:5/21/2020 访问量:12484

问:

我的目标是在 Visual Studio 中使用 Rest API。 我从 https://github.com/Microsoft/vcpkg 下载了C++工具vcpkg,并按照 https://github.com/Microsoft/cpprestsdk 上的说明安装cpprestsdk。效果很好。

然后,在 Visual Studio 的解决方案资源管理器的属性中,我将以下路径从 vcpkg 文件夹包含在“VCC++ Directories->Include directories”中:

vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\cpprest

vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include

vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\pplx

然后我运行我的代码,出现以下错误:

LNK2001 unresolved external symbols(32 个这样的错误)

我用谷歌搜索了一下,并被告知将相应的“.lib”文件包含在“Properties->Linker->Input->Additional Dependencies”中,并将相应的“.dll”文件的路径包含在“Properties->Linker->General->Additional Library Directories”中,我做了什么。

现在,再次运行代码,仅发生以下错误:

code execution cannot proceed because cpprest_2_10.dll was not found. Reinstalling the program may fix the problem,

尽管“cpprest_2_10.dll”在我之前包含的路径中。

我不知道问题出在哪里。提前感谢您抽出宝贵时间接受采访。

C++ DLL visual-studio-2017 未解析的外部

评论


答:

9赞 nio 7/24/2018 #1

尝试将丢失的dll文件直接放到已编译的exe的目录中。

或者检查此答案以设置路径,以便二进制文件可以找到 dll 文件:

如何在 Visual Studio 中设置 DLL 文件的路径?

评论

2赞 Scott McAllister 7/22/2020
我可以确认将丢失的dll与exe放在同一目录中是有效的。我按照这个C++在 dominoc925.blogspot.com/2016/08/.dll教程......