我正在尝试将WPP日志记录添加到我的Win应用程序中。我从WinDDK的tracedrv示例开始,并编写了这个应用程序:
I'm trying to add WPP logging to my Win app. I start with tracedrv example from WinDDK, and wrote this app:
#include" stdafx.h" #include" tracedef.h" extern"C" {//另一个帖子暗示了这一点,但没有任何区别 #include" EtwTracingDemo.tmh" //由Tracewpp.exe生成 } int _tmain(int argc,_TCHAR * argv []) { int输入; WPP_INIT_TRACING(L" EtwTracingDemo"); while((input = getchar())!= EOF) b $ b { printf(" Write a trace \\\"); DoTraceMessage(FLAG_ONE ,""Hello%d",22); // C3861未找到标识符 } WPP_CLEANUP(); 返回0; } 然后从命令行运行以下命令生成EtwTracingDemo.tmh: c: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \rev1 -odir:。 EtwTracingDemo.cpp
#include "stdafx.h" #include "tracedef.h" extern "C" { // another thread suggested this butdidn't make a difference #include "EtwTracingDemo.tmh" // generated by Tracewpp.exe } int _tmain(int argc, _TCHAR* argv[]) { int input; WPP_INIT_TRACING(L"EtwTracingDemo"); while((input = getchar()) != EOF) { printf("Write a trace\n"); DoTraceMessage(FLAG_ONE, "Hello %d", 22); //C3861identifier not found } WPP_CLEANUP(); return 0; } Then from the command lineI ran the following to generate EtwTracingDemo.tmh: c:\src\EtwTracingDemo\EtwTracingDemo>C:\WinDDK\7600.16385.1\bin\x86\tracewpp.EXE -cfgdir:C:\WinDDK\7600.16385.1\bin\wppconfig\rev1 -odir:. EtwTracingDemo.cpp
然后尝试在VC ++ 2010 Express中编译项目,但是我收到了错误: etwtracingdemo.cpp(18):错误C2065:'FLAG_ONE':未声明的标识符 etwtracingdemo.cpp(18):错误C3861:'WPP_CALL_EtwTracingDemo_cpp':未找到标识符
Then tried tocompile the project in VC++2010 Express, but I'm getting errors: etwtracingdemo.cpp(18): error C2065: 'FLAG_ONE' : undeclared identifier etwtracingdemo.cpp(18): error C3861: 'WPP_CALL_EtwTracingDemo_cpp': identifier not found
任何想法可能是什么去吧?我已经花了太多时间在这上面,任何帮助都会受到赞赏。
Any idea what might be going on here? I already spent too much time on this and any help would be appreciated.
我的TraceDef.h如下所示: #define WPP_CONTROL_GUIDS \ WPP_DEFINE_CONTROL_GUID(CtlGuid,(4ba18b42,3cfe,4a09,943e,98ed84035fac), \ WPP_DEFINE_BIT(FLAG_ONE) \ WPP_DEFINE_BIT(FLAG_TWO))
My TraceDef.h looks like this: #define WPP_CONTROL_GUIDS \ WPP_DEFINE_CONTROL_GUID(CtlGuid,(4ba18b42, 3cfe, 4a09, 943e, 98ed84035fac), \ WPP_DEFINE_BIT(FLAG_ONE) \ WPP_DEFINE_BIT(FLAG_TWO) )
推荐答案更改项目的"调试信息格式"来自"编辑数据库"和"编辑数据库"。继续(/ ZI)"到"程序数据库(/ Zi)",你就可以编译了。 Change your project's "Debug Information Format" from "Program Database for Edit & Continue (/ZI)" to "Program Database (/Zi)", and you will be able to compile.
更多推荐
找不到DoTraceMessage标识符
发布评论