找不到DoTraceMessage标识符 [英] DoTraceMessage identifier not found

查看:616
本文介绍了找不到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)< br $> 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 but didn'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); // C3861 identifier not found
 }
 WPP_CLEANUP();
 return 0;
}

Then from the command line I 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 to compile 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标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆