我尝试使用WPP在用户模式下,设法成功地使用它在VS10,发行对象通过向凸出文件:使用WPP从用户模式应用
<PropertyGroup><WdkDir>c:\work\Proj\wppTest\DDK\</WdkDir><MyTargetsDir>c:\work\Proj\wppTest</MyTargetsDir> </PropertyGroup>
...
<ImportGroup Label="ExtensionTargets">
<Import Project="$(MyTargetsDir)\Wpp.targets" />
</ImportGroup>
然后Wpp.targets这样定义:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.tmh</ExtensionsToDeleteOnClean>
</PropertyGroup>
<ItemGroup>
<CoreCppClean Include="@(CoreCppClean);$(ProjectDir)">
<FilePatternsToDelete>*.tmh</FilePatternsToDelete>
</CoreCppClean>
</ItemGroup>
<ItemGroup>
<TraceWppSources Include="@(ClCompile)" Exclude="stdafx.cpp" />
</ItemGroup>
<Target Name="TraceWpp" BeforeTargets="ClCompile" Inputs="@(TraceWppSources)" Outputs="@(TraceWppSources -> '%(Filename).tmh')">
<Exec Command="cd $(ProjectDir)" />
<Message Importance="high" Text="Creating tmh"/>
<Exec Command="$(WdkDir)\bin\x86\tracewpp.EXE -cfgdir:$(WdkDir)\bin\wppconfig\rev1 -odir:. @(TraceWppSources, ' ')" />
<Message Importance="high" Text="tmh created"/>
</Target>
</Project>
此步骤是从文章采取:http://www.devproconnections.com/article/visual-studio-2010/wpp-tracing-in-visual-c-2010-projects
当试图编译这个VS10-下>调试我可以看到正在才会产生“TMH”文件时I g et error when actualy我想记录一些东西:
DoTraceMessage(TRACE_ERROR,L“Aha”); //错误C2065:'TRACE_ERROR':未声明的标识符错误C3861:'WPP_CALL_Application_Test_cpp':未找到标识符
正如我所说的,我对VS10-> Release target上的相同代码没有问题。这里是我的参考定义:
#pragma once
#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID(CtlGuid,(28EE579B, CF67, 43b6, 9D19, 8930E7AAA131), \
\
WPP_DEFINE_BIT(TRACE_ERROR) \
WPP_DEFINE_BIT(TRACE_WARNING) \
WPP_DEFINE_BIT(TRACE_INFO1) \
WPP_DEFINE_BIT(TRACE_INFO2) \
)
没有人有任何想法,为什么可能工作使用发行模式,但在调试模式下不起作用?