现在的位置: 首页 > 综合 > 正文

编译

2018年05月04日 ⁄ 综合 ⁄ 共 1988字 ⁄ 字号 评论关闭

windows高级调试例子直接编译要下载DDK

然后在开始菜单中打开相应的命令行,比如 x86 free build enviroment,然后cd **\Chapter1

输入build

会有错误:

1>errors in directory d:\windows高级调试\source\chapter1
1>d:\winddk\7600.16385.1\bin\makefile.new(362) : error U1050: d:\windows高级调试\source\chapter1: USE_NATIVE_EH has an invalid value, change it to 1.
1>nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2

解决方法是修改当前目录下souces文件,

最后一行 USE_NATIVE_EH=SYNC

该为 USE_NATIVE_EH=ASYNC

再次build可以成功,生成文件放在D:\windows\objfre_wxp_x86\i386

编译chapter2中内容的时候会有错误

Linking Executable - d:\windows\objfre_wxp_x86\i386\02sample.exe
1>errors in directory d:\windows高级调试\source\chapter2
1>d:\windows高级调试\source\chapter2\param64.obj : error LNK2019: unresolved external symbol "int __stdcall CalledFunction1(int)" (?CalledFunction1@@YGHH@Z) referenced in function "int __stdcall Function1(int)" (?Function1@@YGHH@Z)
1>d:\windows高级调试\source\chapter2\param64.obj : error LNK2019: unresolved external symbol "int __stdcall CalledFunction2(int,int)" (?CalledFunction2@@YGHHH@Z) referenced in function "int __stdcall Function2(int,int)" (?Function2@@YGHHH@Z)
1>d:\windows高级调试\source\chapter2\param64.obj : error LNK2019: unresolved external symbol "int __stdcall CalledFunction3(int,int,int)" (?CalledFunction3@@YGHHHH@Z) referenced in function "int __stdcall Function3(int,int,int)" (?Function3@@YGHHHH@Z)
1>d:\windows高级调试\source\chapter2\param64.obj : error LNK2019: unresolved external symbol "int __stdcall CalledFunction4(int,int,int,int)" (?CalledFunction4@@YGHHHHH@Z) referenced in function "int __stdcall Function4(int,int,int,int)" (?Function4@@YGHHHHH@Z)
1>d:\windows高级调试\source\chapter2\param64.obj : error LNK2019: unresolved external symbol "int __stdcall CalledFunction5(int,int,int,int,int)" (?CalledFunction5@@YGHHHHHH@Z) referenced in function "int __stdcall Function5(int,int,int,int,int)" (?Function5@@YGHHHHHH@Z)
1>d:\windows\objfre_wxp_x86\i386\02sample.exe : error LNK1120: 5 unresolved externals

原因是chapter1与chapter2的输出目录相同,而编译完chapter1以后已经有了sample.obj,导致chapter2中的sample.cpp没有编译

将D:\windows\objfre_wxp_x86\i386中的sample.obj删除即可编译成功

【上篇】
【下篇】

抱歉!评论已关闭.