阅读:2088回复:7
Help-编译连接问题
俺写了一个只有加载设备功能的最简单的driver
可老是编译不过,下面是编译信息: D:\Driver_Dev\Firstprj\sys>build nmake /a BUILD: Object root set to: ==> objchk BUILD: /i switch ignored BUILD: Compile and Link for i386 BUILD: Loading d:\NTDDK\build.dat... BUILD: Computing Include file dependencies: BUILD: Examining d:\driver_dev\firstprj\sys directory for files to compile. d:\driver_dev\firstprj\sys - 3 source files (88 lines) BUILD: Compiling d:\driver_dev\firstprj\sys directory Compiling - init.cpp for i386 Compiling - dispatch.cpp for i386 Compiling - pnp.cpp for i386 Linking Executable - objchk\i386\usbkey.sys for i386 link() : error LNK1181: cannot open input file "objchk\i386\init.obj" BUILD: Linking d:\driver_dev\firstprj\sys directory Compiling - init.cpp for i386 Compiling - dispatch.cpp for i386 Compiling - pnp.cpp for i386 Linking Executable - objchk\i386\usbkey.sys for i386 link() : error LNK1181: cannot open input file "objchk\i386\init.obj" BUILD: Done 3 files compiled 2 executables built - 2 Errors ?为啥没有生成目标文件?真是可恶,明明说3 files compiled的嘛。 下面是俺的SOURCE: TARGETNAME=UsbKey TARGETTYPE=DRIVER DRIVERTYPE=WDM TARGETPATH=OBJ INCLUDES=$(BASEDIR)\inc; SOURCES= Init.cpp \ Dispatch.cpp \ Pnp.cpp NTTARGETFILES=PostBuildSteps 拜托高手同志帮俺解惑,先行谢过。 |
|
|
沙发#
发布于:2001-06-19 10:29
你有objchk\i386这个目录吗?
|
|
|
板凳#
发布于:2001-06-19 11:44
有啊,这些目录都生成了
就是不见obj文件在里面 |
|
|
地板#
发布于:2001-06-19 12:41
如果是在98DDK编译的,Driver_Dev超过了8个字符.把路径都改成短路径名.
|
|
|
地下室#
发布于:2001-06-19 15:56
俺是在2000下build的,
俺怀疑根本没有编译, 不知什么情况下会好象编译了却什么也没做? |
|
|
5楼#
发布于:2001-06-19 16:13
把build 生成的文件和目录删除,重新编译!
|
|
6楼#
发布于:2001-06-19 17:27
删了,还是不行。
代码如下: //------------------------------ //pnp.cpp: // UsbKeyAddDev(); #include "UsbKey.h" #pragma code_seg("PAGE") NTSTATUS UsbKeyAddDev(IN PDRIVER_OBJECT dro,IN PDEVICE_OBJECT pdo){ NTSTATUS status; PDEVICE_OBJECT fdo; status=IoCreateDevice( dro,sizeof(USBKEY_DEVICE_EXTENSION), NULL, FILE_DEVICE_UNKNOWN, 0,FALSE, &fdo ); if(!NT_SUCCESS(status)) return status; PUSBKEY_DEVICE_EXTENSION dx=(PUSBKEY_DEVICE_EXTENSION)fdo->DeviceExtension; dx->pdo=pdo; dx->fdo=fdo; dx->NextStackDevice=IoAttachDeviceToDeviceStack(fdo,pdo); return STATUS_SUCCESS; } #pragma code_seg() // //------------------------------- //Dispatch.cpp // UsbKeyCreate Routine #include "UsbKey.h" NTSTATUS UsbKeyCreate(IN PDEVICE_OBJECT fdo,IN PIRP irp){ return CompleteIrp(irp,STATUS_SUCCESS,0); } //------------------------ //init.cpp // DriverEntry() #include "UsbKey.h" #pragma code_seg("INIT") extern "C" NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ){ NTSTATUS status=STATUS_SUCCESS; DriverObject->DriverExtension->AddDevice=UsbKeyAddDev; DriverObject->MajorFunction[IRP_MJ_CREATE]=UsbKeyCreate; return status; } #pragma code_seg() |
|
|
7楼#
发布于:2001-06-20 10:54
大伙别拦着俺,俺要自杀了......
|
|
|