阅读:2215回复:11
!!!为什么出现这样的错误???――WDM程序编译
为什么出现这样的错误:
--------------------Configuration: aiherong - Win32 Debug-------------------- New or updated MSVC detected. Updating DDK environment.... Setting environment for using Microsoft Visual C++ tools. Starting dirs creation...Completed. BUILD: Object root set to: ==> objchk BUILD: /i switch ignored BUILD: Compile and Link for i386 BUILD: Loading c:\\NTDDK\\build.dat... BUILD: Computing Include file dependencies: BUILD: Examining c:\\temp\\lasthope\\aiherong directory for files to compile. c:\\temp\\lasthope\\aiherong c:\\temp\\lasthope\\aiherong - 1 source files (0 lines) BUILD: Compiling c:\\temp\\lasthope\\aiherong directory Compiling - aiherong.cpp for i386 Linking Executable - objchk\\i386\\aiherong.sys for i386 link() : error LNK2001: unresolved external symbol _DriverEntry@8 aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall ObfDereferenceObject(void *)\" (__imp_?ObfDereferenceObject@@YIXPAX@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall IoDeleteDevice(struct _DEVICE_OBJECT *)\" (__imp_?IoDeleteDevice@@YGXPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoDeleteSymbolicLink(struct _UNICODE_STRING *)\" (__imp_?IoDeleteSymbolicLink@@YGJPAU_UNICODE_STRING@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoGetDeviceObjectPointer(struct _UNICODE_STRING *,unsigned long,struct _FILE_OBJECT * *,struct _DEVICE_OBJECT * *)\" (__imp_?IoGetDeviceObjectPointer@@YG JPAU_UNICODE_STRING@@KPAPAU_FILE_OBJECT@@PAPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"unsigned long __cdecl DbgPrint(char *,...)\" (?DbgPrint@@YAKPADZZ) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateSymbolicLink(struct _UNICODE_STRING *,struct _UNICODE_STRING *)\" (__imp_?IoCreateSymbolicLink@@YGJPAU_UNICODE_STRING@@0@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateDevice(struct _DRIVER_OBJECT *,unsigned long,struct _UNICODE_STRING *,unsigned long,unsigned long,unsigned char,struct _DEVICE_OBJECT * *)\" (__i mp_?IoCreateDevice@@YGJPAU_DRIVER_OBJECT@@KPAU_UNICODE_STRING@@KKEPAPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall RtlInitUnicodeString(struct _UNICODE_STRING *,unsigned short const *)\" (__imp_?RtlInitUnicodeString@@YGXPAU_UNICODE_STRING@@PBG@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall IofCompleteRequest(struct _IRP *,char)\" (__imp_?IofCompleteRequest@@YIXPAU_IRP@@D@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall KeWaitForSingleObject(void *,enum _KWAIT_REASON,char,unsigned char,union _LARGE_INTEGER *)\" (__imp_?KeWaitForSingleObject@@YGJPAXW4_KWAIT_REASON@@DEPAT_ LARGE_INTEGER@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __fastcall IofCallDriver(struct _DEVICE_OBJECT *,struct _IRP *)\" (__imp_?IofCallDriver@@YIJPAU_DEVICE_OBJECT@@PAU_IRP@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) struct _IRP * __stdcall IoBuildDeviceIoControlRequest(unsigned long,struct _DEVICE_OBJECT *,void *,unsigned long,void *,unsigned long,unsigned char,struct _KEVENT *,st ruct _IO_STATUS_BLOCK *)\" (__imp_?IoBuildDeviceIoControlRequest@@YGPAU_IRP@@KPAU_DEVICE_OBJECT@@PAXK1KEPAU_KEVENT@@PAU_IO_STATUS_BLOCK@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall KeInitializeEvent(struct _KEVENT *,enum _EVENT_TYPE,unsigned char)\" (__imp_?KeInitializeEvent@@YGXPAU_KEVENT@@W4_EVENT_TYPE@@E@Z) objchk\\i386\\aiherong.sys() : error LNK1120: 14 unresolved externals BUILD: Linking c:\\temp\\lasthope\\aiherong directory Linking Executable - objchk\\i386\\aiherong.sys for i386 link() : error LNK2001: unresolved external symbol _DriverEntry@8 aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall ObfDereferenceObject(void *)\" (__imp_?ObfDereferenceObject@@YIXPAX@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall IoDeleteDevice(struct _DEVICE_OBJECT *)\" (__imp_?IoDeleteDevice@@YGXPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoDeleteSymbolicLink(struct _UNICODE_STRING *)\" (__imp_?IoDeleteSymbolicLink@@YGJPAU_UNICODE_STRING@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoGetDeviceObjectPointer(struct _UNICODE_STRING *,unsigned long,struct _FILE_OBJECT * *,struct _DEVICE_OBJECT * *)\" (__imp_?IoGetDeviceObjectPointer@@YG JPAU_UNICODE_STRING@@KPAPAU_FILE_OBJECT@@PAPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"unsigned long __cdecl DbgPrint(char *,...)\" (?DbgPrint@@YAKPADZZ) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateSymbolicLink(struct _UNICODE_STRING *,struct _UNICODE_STRING *)\" (__imp_?IoCreateSymbolicLink@@YGJPAU_UNICODE_STRING@@0@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateDevice(struct _DRIVER_OBJECT *,unsigned long,struct _UNICODE_STRING *,unsigned long,unsigned long,unsigned char,struct _DEVICE_OBJECT * *)\" (__i mp_?IoCreateDevice@@YGJPAU_DRIVER_OBJECT@@KPAU_UNICODE_STRING@@KKEPAPAU_DEVICE_OBJECT@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall RtlInitUnicodeString(struct _UNICODE_STRING *,unsigned short const *)\" (__imp_?RtlInitUnicodeString@@YGXPAU_UNICODE_STRING@@PBG@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall IofCompleteRequest(struct _IRP *,char)\" (__imp_?IofCompleteRequest@@YIXPAU_IRP@@D@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall KeWaitForSingleObject(void *,enum _KWAIT_REASON,char,unsigned char,union _LARGE_INTEGER *)\" (__imp_?KeWaitForSingleObject@@YGJPAXW4_KWAIT_REASON@@DEPAT_ LARGE_INTEGER@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __fastcall IofCallDriver(struct _DEVICE_OBJECT *,struct _IRP *)\" (__imp_?IofCallDriver@@YIJPAU_DEVICE_OBJECT@@PAU_IRP@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) struct _IRP * __stdcall IoBuildDeviceIoControlRequest(unsigned long,struct _DEVICE_OBJECT *,void *,unsigned long,void *,unsigned long,unsigned char,struct _KEVENT *,st ruct _IO_STATUS_BLOCK *)\" (__imp_?IoBuildDeviceIoControlRequest@@YGPAU_IRP@@KPAU_DEVICE_OBJECT@@PAXK1KEPAU_KEVENT@@PAU_IO_STATUS_BLOCK@@@Z) aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall KeInitializeEvent(struct _KEVENT *,enum _EVENT_TYPE,unsigned char)\" (__imp_?KeInitializeEvent@@YGXPAU_KEVENT@@W4_EVENT_TYPE@@E@Z) objchk\\i386\\aiherong.sys() : error LNK1120: 14 unresolved externals BUILD: Done 1 file compiled - 0 LPS 2 executables built - 30 Errors Error executing d:\\winnt\\system32\\cmd.exe. aiherong.sys - 30 error(s), 0 warning(s) |
|
沙发#
发布于:2002-07-12 10:11
试试:
#ifdef __cplusplus extern \"C\" { #endif #include \"wdm.h\" #ifdef __cplusplus } #endif |
|
|
板凳#
发布于:2002-07-12 11:24
用户被禁言,该主题自动屏蔽! |
|
地板#
发布于:2002-07-12 12:14
谢谢!不过错误变成:
--------------------Configuration: ColdBad - Win32 Debug-------------------- Compiling... Command line warning D4024 : unrecognized source file type \'CONDITION_HANDLING=1\', object file assumed Command line warning D4027 : source file \'CONDITION_HANDLING=1\' ignored aiherong.cpp Linking... aiherong.obj : error LNK2001: unresolved external symbol __imp__IoDeleteSymbolicLink aiherong.obj : error LNK2001: unresolved external symbol __imp__IoGetDeviceObjectPointer aiherong.obj : error LNK2001: unresolved external symbol __imp__IoDeleteDevice aiherong.obj : error LNK2001: unresolved external symbol __imp__IoCreateSymbolicLink aiherong.obj : error LNK2001: unresolved external symbol __imp__IoCreateDevice aiherong.obj : error LNK2001: unresolved external symbol __imp__KeWaitForSingleObject aiherong.obj : error LNK2001: unresolved external symbol __imp__IoBuildDeviceIoControlRequest aiherong.obj : error LNK2001: unresolved external symbol __imp__KeInitializeEvent .\\i386\\checked\\aiherong.sys : fatal error LNK1120: 8 unresolved externals Error executing link.exe. aiherong.sys - 9 error(s), 2 warning(s) The following environment variables were not found $(BASEDIR) $(CPU) $(DRIVERWORKS) |
|
地下室#
发布于:2002-07-12 12:36
你是不是既有C又有C++文件啊?!
|
|
|
5楼#
发布于:2002-07-12 12:46
是我弄错了,不过错误变成:
--------------------Configuration: aiherong - Win32 Debug-------------------- New or updated MSVC detected. Updating DDK environment.... Setting environment for using Microsoft Visual C++ tools. Starting dirs creation...Completed. BUILD: Object root set to: ==> objchk BUILD: /i switch ignored BUILD: Compile and Link for i386 BUILD: Loading c:\\NTDDK\\build.dat... BUILD: Computing Include file dependencies: BUILD: Examining c:\\temp\\lasthope\\aiherong directory for files to compile. c:\\temp\\lasthope\\aiherong c:\\temp\\lasthope\\aiherong - 1 source files (0 lines) BUILD: Compiling c:\\temp\\lasthope\\aiherong directory Compiling - aiherong.cpp for i386 Linking Executable - objchk\\i386\\aiherong.sys for i386 link() : error LNK2001: unresolved external symbol _DriverEntry@8 objchk\\i386\\aiherong.sys() : error LNK1120: 1 unresolved externals BUILD: Linking c:\\temp\\lasthope\\aiherong directory Linking Executable - objchk\\i386\\aiherong.sys for i386 link() : error LNK2001: unresolved external symbol _DriverEntry@8 objchk\\i386\\aiherong.sys() : error LNK1120: 1 unresolved externals BUILD: Done 1 file compiled - 0 LPS 2 executables built - 4 Errors Error executing d:\\winnt\\system32\\cmd.exe. aiherong.sys - 4 error(s), 0 warning(s) |
|
6楼#
发布于:2002-07-12 13:09
请TIGERZD大侠帮忙!
|
|
7楼#
发布于:2002-07-12 13:36
link() : error LNK2001: unresolved external symbol _DriverEntry@8
-------------------------------------- 给DriverEntry添加一个声明 extern \"C\" ULONG DriverEntry(IN PVOID, IN PVOID); |
|
|
8楼#
发布于:2002-07-12 14:47
我的问题解决了,不知如何给帮助我的朋友们加分?怎么操作?
|
|
9楼#
发布于:2002-07-12 18:21
我的问题解决了,不知如何给帮助我的朋友们加分?怎么操作? 发贴上有给分按纽。 |
|
|
10楼#
发布于:2002-07-13 12:03
本人愚笨,还是找不到“给分”按钮在何处啊!
|
|
11楼#
发布于:2004-04-23 20:30
我也有这个问题,还是解决不了。
Compiling... T.c Linking... T.obj : error LNK2001: unresolved external symbol __imp__IoGetDeviceObjectPointer T.obj : error LNK2001: unresolved external symbol __imp__RtlInitUnicodeString@8 Debug/T.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. T.exe - 3 error(s), 0 warning(s) 代码:#include<wdm.h> #include <ntddk.h> #include <stdio.h> #include <parallel.h> main() { NTSTATUS status; PFILE_OBJECT PortFileObject; PDEVICE_OBJECT PortDeviceObject; UNICODE_STRING PortDeviceObjectName; RtlInitUnicodeString(&PortDeviceObjectName, L\"\\\\Device\\\\Parallel0\"); status = IoGetDeviceObjectPointer( &PortDeviceObjectName, FILE_ALL_ACCESS, &PortFileObject, &PortDeviceObject ); if (!NT_SUCCESS(status)) { printf(\"err\\n\"); } } 我是新手,谢谢各位了。 |
|
|