新建 -> 项目 -> 选择内核模式驱动程序,USB (KMDF)。没有任何修改,这个-6ren">
gpt4 book ai didi

c++ - 错误 MSB6006 : "link.exe" exited with code 1 When run SDV ( Static Driver Verifier) , Visual Studio 2019,SDK 10 build 19041,windows 10 build 19041

转载 作者:行者123 更新时间:2023-12-05 05:56:06 24 4
gpt4 key购买 nike

我们创建新的 KMDF USB 项目,打开 visual studio 2019 v 16.11,转到文件 -> 新建 -> 项目 -> 选择内核模式驱动程序,USB (KMDF)。没有任何修改,这个项目没有错误,构建时没有警告。当我们为此项目运行 SDV(静态驱动程序验证程序)时,smvbuild.log 显示此错误。

C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wmilib.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfLdr.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfDriverEntry.lib" usbdex.lib ntstrsafe.lib "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wpprecorder.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"FxDriverEntry@8" /RELEASE /IMPLIB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X86 /PROFILE /SAFESEH /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221 /osversion:10.0 /pdbcompress /debugtype:pdata Release\Device.obj
Release\Driver.obj
Release\Queue.obj

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1074,5): error MSB6006: "link.exe" exited with code 1. [C:\Users\tungpvt\source\repos\USB Driver2\USB Driver2\USB Driver2.vcxproj]
Done executing task "Link" -- FAILED.
Done building target "Link" in project "USB Driver2.vcxproj" -- FAILED.
Done Building Project "C:\Users\tungpvt\source\repos\USB Driver2\USB Driver2\USB Driver2.vcxproj" (rebuild target(s)) -- FAILED.

此外,当在命令行上运行 link.exe 时,Visual studio -> Tools -> Command Line -> Developer Command Prompt 具有与上面相同的参数,它显示:

Failed to load Intercept.XML:
Could not find file 'c:\program files (x86)\windows kits\10\tools\sdv\smv\bin\%BE%-Intercept.xml'.

我们已将 BE 和 smv 变量添加到 Windows 系统环境

variable name: BE , variable value: MSBuild
variable name: smv , variable value: C:\Program Files (x86)\Windows Kits\10\Tools\sdv\smv

在Project properties中的Linker session中,我们修改了Project properties -> Linker -> Input -> Additional Dependency to

%(AdditionalDependencies);$(DDK_LIB_PATH)usbdex.lib;$(DDK_LIB_PATH)ntstrsafe.lib

然后我们可以通过命令行

C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wmilib.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfLdr.lib" "C:\Program Files (x86)\Windows Kits\10\lib\wdf\kmdf\x86\1.15\WdfDriverEntry.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\usbdex.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\ntstrsafe.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\km\x86\wpprecorder.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"FxDriverEntry@8" /RELEASE /IMPLIB:"C:\Users\tungpvt\source\repos\USB Driver2Release\USBDriver2.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X86 /PROFILE /SAFESEH /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221 /osversion:10.0 /pdbcompress /debugtype:pdata Release\Device.obj
Release\Driver.obj
Release\Queue.obj

但是仍然运行SDV错误。

请帮我解决这个问题。谢谢。

============================================= ============================

在我更新到最新的 SDK、WDK 到版本 10.1.22000 并更新 visual studio 2019 之后,模板驱动程序的错误消失了,但我在我的项目中遇到了其他问题

sdv/smvcl.log 

c1 : fatal error C1252: Circular or missing dependency between plugins: 'PREfast Drivers Plugin' requires GUID '{EB170136-3433-4C16-AE1D-8998BA5CAB16}'.

谁能帮帮我?

最佳答案

您好,我在使用 WDK 10.0.22000(使用 visual studio 2019)时遇到了这个问题(静态驱动程序验证程序构建上的链接器错误),这是我找到的解决方案:它在编译时定义宏 NT_PROCESSOR_GROUPS 时链接(有重建所有),所以将这个宏添加到预处理器定义中就可以了(至少对于我的设置)。

以防万一您现在或将来遇到静态驱动程序验证程序故障,这里有一个有用的提示:

在启用/debug 的情况下运行 SDV 目标:so

msbuild /t:sdv /p:Inputs="/check:* /debug" path\to\myproject.vcxproj /p:Configuration=Release /p:Platform=x64 /maxCpuCount=8

将创建调试日志。链接器的输出位于 sdv 子目录中并命名为 smvlink1.log 。该目录中还有其他有用的日志文件(我花了很长时间才找到它们,但输出将我引向了上面提出的解决方案)。

关于c++ - 错误 MSB6006 : "link.exe" exited with code 1 When run SDV ( Static Driver Verifier) , Visual Studio 2019,SDK 10 build 19041,windows 10 build 19041,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69293585/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com