找不到DoTraceMessage标识符

编程入门 行业动态 更新时间:2024-10-23 13:24:32
本文介绍了找不到DoTraceMessage标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试将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标识符

本文发布于:2023-10-07 15:26:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469771.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识符   找不到   DoTraceMessage

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!