When using WPP in Visual Studio (2012) each occurence of TraceEvents(...)
has a wavy underline and the help text is e.g.
#define TraceEvents WPP_(CALL)
error: identifier WPP_Call_Foo_cppNNN not defined
Well, it is defined, in the .tmh header file created by the WPP preprocessor and the project compiles just fine. But Visual Studio doesn't scan and/or recognize this file.
Is there a practical way of getting rid of those squiggles?
Oct 12 2018 03:38 PM Most Microsoft-provided drivers, included in Windows, enable WPP tracing for debugging purposes. It’s easier to debug when there are trace messages available.
In Windows 8, the switch –public:<funcName> was added to the WPP preprocessor so that it can keep <funcName> trace annotations in the public PDB file. To specify that switch, in your project settings in Visual Studio, select WPP Tracing->Command Line .
To add the default form of WPP software tracing to a trace provider, such as a kernel-mode driver or a user-mode application, add the following C preprocessor directives and WPP macro calls to the provider's source code: An #include directive of the following form to each source file that contains any WPP macros.
In Windows 8, the build and other WPP utilities have been enhanced to include trace messages in public PDBs. You can use the symbol file to capture WPP trace messages without worrying about out-of-sync TMF and symbol files. In this blog post, we’ll describe:
For now I work around the problem by putting
#ifdef __INTELLISENSE__
#undef TraceEvents
#define TraceEvents(a,b,...)
#endif
in one of the header files that are included after the .tmh in all of the files anyway.
The define __INTELLISENSE__
is mentioned in http://blogs.msdn.com/b/vcblog/archive/2011/03/29/10146895.aspx
Edit for Visual Studio 2012:
It appears you've reached the analysis limit of the preprocessor in Visual Studio 2012's IntelliSense engine. If you replace the TraceEvents
reference with WPP_Call_Foo_cppNNN
, it actually resolves the identifier without problems (until you rebuild the solution and the tmh header changes).
The solution is to load the solution in Visual Studio 2013, and choose to not upgrade the compiler toolchain, thus preserving backwards compatibility with Visual Studio 2012.
Previous Answer for Visual Studio 2013:
This was tested in Visual Studio 2013, so it may not apply to Visual Studio 2012. I couldn't find a release of the WDK that supports Visual Studio 2012, so you'll need to let me know how to configure the environment if the following steps do not work.
After building your project (to ensure the .tmh files exist), execute the Project → Rescan Solution command.
I also recommend you associate the files with the C++ editor through the following steps:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With