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

joh*_*876 4 c++ dll unresolved-external visual-studio-2017 lib

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

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

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”文件包含到“属性->链接器->输入->附加依赖项”中,并将相应的“.dll”文件的路径包含到“属性->链接器”中->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”在我之前包含的路径中。

我不知道问题是什么。提前感谢您的时间。

nio*_*nio 6

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

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

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

  • 我可以确认将丢失的 dll 放在与 exe 相同的目录中是可行的。我正在关注 https://dominoc925.blogspot.com/2016/08/use-cmake-to-help-build-and-use-windows.htmlvisual 上的 C++ 到 .dll 教程 (2认同)