阅读:1523回复:11
ntddk下BUILD只能编译.c文件,C++文件就出错请高手指教?
如题
|
|
最新喜欢:![]() |
沙发#
发布于:2002-06-16 21:43
这种问题比较的多。。。。。。。。 是编译时,函数名处理的方式不同引起的。。。。 你在论坛,搜一下。。。。。 有extern \"C\" { .............. } :) |
|
|
板凳#
发布于:2002-06-16 21:44
这种问题比较的多。。。。。。。。 是编译时,函数名处理的方式不同引起的。。。。 你在论坛,搜一下。。。。。(详细的) 有extern \"C\" { .............. } :) |
|
|
地板#
发布于:2002-06-17 09:32
extern \"C\"
{ #include \"ntddk.h\" } 就行了 |
|
|
地下室#
发布于:2002-06-17 14:33
我在.h文件中加入了呀,怎么还不行?
|
|
5楼#
发布于:2002-06-17 14:47
改扩展名。
|
|
6楼#
发布于:2002-06-17 16:16
我曾经编译成功过。你的错误提示是什么?
|
|
|
7楼#
发布于:2002-06-17 17:20
改扩展名不行我试了。编译错误提示如下:
E:\\ddksrc\\2000ddk>build BUILD: Object root set to: ==> objchk BUILD: /i switch ignored BUILD: Compile and Link for i386 BUILD: Loading e:\\NTDDK\\build.dat... BUILD: Computing Include file dependencies: BUILD: Examining e:\\ddksrc\\2000ddk directory for files to compile. e:\\ddksrc\\2000ddk - 1 source files (327 lines) BUILD: Saving e:\\NTDDK\\build.dat... BUILD: Compiling e:\\ddksrc\\2000ddk directory Compiling - hellowdm.cpp for i386 BUILD: Linking e:\\ddksrc\\2000ddk directory Linking Executable - e:\\ntddk\\lib\\i386\\hellowdm.sys for i386 link() : error LNK2001: unresolved external symbol _DriverEntry@8 e:\\ntddk\\lib\\i386\\hellowdm.sys() : error LNK1120: 1 unresolved externals BUILD: Done |
|
8楼#
发布于:2002-06-17 17:27
DriverEntry都不认?
|
|
9楼#
发布于:2002-06-17 17:49
改扩展名不行我试了。编译错误提示如下: 绝对是extern \"C\" 的错误,原形声明和函数体定义处都需要加extern \"C\", 如下: 1.原形声明 #ifdef __cplusplus { extern \"C\" #include \"NTDDK.h\" #endif ... #ifdef __cplusplus } #endif 2.函数体定义: extern \"C\" NTSATTUS DriverEntry( IN PDRIVER_OBJECT pdo, IN ...) { ... } |
|
|
10楼#
发布于:2002-06-18 08:20
谢谢斑竹,问题解决了!以后我会常来捧场的!
|
|
11楼#
发布于:2002-06-18 09:11
还是斑竹厉害。 :D
|
|