windows - 错误 LNK2019:未解析的外部符号 __CheckForDebuggerJustMyCode 在函数 DriverEntry 中引用
问题描述
我编写了一个 Windows 10 驱动程序。
以下是代码,实际上代码是 docs.microsoft.com 的示例。
有没有人知道我该怎么处理这个问题。
#include <ntddk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
// NTSTATUS variable to record success or failure
NTSTATUS status = STATUS_SUCCESS;
// Allocate the driver configuration object
WDF_DRIVER_CONFIG config;
// Print "Hello World" for DriverEntry
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n"));
// Initialize the driver configuration object to register the
// entry point for the EvtDeviceAdd callback, KmdfHelloWorldEvtDeviceAdd
WDF_DRIVER_CONFIG_INIT(&config,
KmdfHelloWorldEvtDeviceAdd
);
// Finally, create the driver object
status = WdfDriverCreate(DriverObject,
RegistryPath,
WDF_NO_OBJECT_ATTRIBUTES,
&config,
WDF_NO_HANDLE
);
return status;
}
NTSTATUS
KmdfHelloWorldEvtDeviceAdd(
_In_ WDFDRIVER Driver,
_Inout_ PWDFDEVICE_INIT DeviceInit
)
{
// We're not using the driver object,
// so we need to mark it as unreferenced
UNREFERENCED_PARAMETER(Driver);
NTSTATUS status;
// Allocate the device object
WDFDEVICE hDevice;
// Print "Hello World"
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: KmdfHelloWorldEvtDeviceAdd\n"));
// Create the device object
status = WdfDeviceCreate(&DeviceInit,
WDF_NO_OBJECT_ATTRIBUTES,
&hDevice
);
return status;
}
帮助!如果你有什么建议,请告诉我。
错误信息是:
Driver.obj : error LNK2019: unresolved external symbol __CheckForDebuggerJustMyCode referenced in function DriverEntry
解决方案
这与Visual Studio 2017 15.8 中新的C++ Just My Code Stepping功能有关。
如果出现错误,请打开项目属性对话框并将“配置属性 -> C/C++ -> 常规 -> 仅支持我的代码调试”选项设置为否。
推荐阅读
- hyperledger - 错误:没有来自任何对等方的有效响应(在运行 ./createpeerAdmincard.sh 时)
- ios - 仅使用属性字符串的标记列表
- drools - DMN 与 DRL 的流口水
- html - 使用 HTML 和 CSS 制作移动响应式图像
- javascript - 同一行上的多个 jQueryUI 可排序对象
- mysql - MySQL 8.0.x 导入远比 5.7.x 慢
- jquery - SSL 安全站点中的混合 https 内容
- python - 使用不同的优化器运行 Keras Sequential 模型
- wpf - 在 WPF 中开发可以接受多个搜索文本的搜索控件
- php - PHP/MySQL - 如果变量不存在则更新数组