如何在 visual studio 中包含 Microsoft detours 库

How to include Microsoft detours library in visual studio

我正在尝试在 visual studio 空 windows 项目中使用 detours 库。我克隆了存储库(https://github.com/microsoft/Detours),将包含目录添加到项目属性/C/C++/附加包含目录中,并将 lib.X86 目录添加到项目属性/链接器/附加库目录中.我在文件上看不到任何错误,但是当我构建时我得到

1>Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionBegin@0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionCommit@0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourUpdateThread@4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourAttach@8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourDetach@8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourRestoreAfterWith@0 referenced in function _main
1>C:\Users\colel\source\repos\Project3\Debug\Project3.exe : fatal error LNK1120: 6 unresolved externals
1>Done building project "Project3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========

似乎没有正确包含该库。我如何正确地将 detours 库包含到 visual studio 项目中,我做错了什么?

您需要添加特定的 .lib 文件,我猜它是“detours.lib”(或类似文件)到“附加依赖项”行。

属性->链接器->输入->附加依赖项。