microsoft/WinDbg-Samples

Unable to build SimpleIntroClientLibrary (Cpp)

robmikh opened this issue · 6 comments

I'm trying to build the SimpleIntroClientLibrary sample, and I'm running into some issues.

First off, I retargeted the solution to the 10.0.18362.0 SDK and the v142 platforms tools since that's all I had installed. After that I had to make a few changes to get things building farther:

  • Edited SimpleIntro.h
    • Added #include <new> to deal with an error around the use of bad_alloc
    • Changed #include "DbgModelClientEx.h" to #include <DbgModelClientEx.h> and remove/install the nuget package. (not sure why I had to do this) I changed this back and it works now, so maybe I just had to fiddle with the nuget package.

This cleared most of the errors, but there's one left that I'm not sure how to resolve.

I'm getting a C2039 error from the use of ExtractString in DbgModelClientEx.h. I'm told that 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'... but it clearly is when looking at the header.

Any ideas as to what might be the problem?

Here's the build output:

1>------ Build started: Project: SimpleIntroClientLibrary, Configuration: Debug x64 ------
1>HelloProvider.cpp
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Module::Module(const Debugger::DataModel::ClientEx::HostContext &,TStr &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1502,55): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1502,55): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Symbol Debugger::DataModel::ClientEx::Module::FindSymbol(TStr &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1830,48): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1830,48): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Type::Type(const Debugger::DataModel::ClientEx::HostContext &,TStr1 &&,TStr2 &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1831,35): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1831,35): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Type::Type(const Debugger::DataModel::ClientEx::HostContext &,TStr1 &&,TStr2 &&)'
1>SimpleIntroExtension.cpp
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Module::Module(const Debugger::DataModel::ClientEx::HostContext &,TStr &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1502,55): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1502,55): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Symbol Debugger::DataModel::ClientEx::Module::FindSymbol(TStr &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1830,48): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1830,48): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Type::Type(const Debugger::DataModel::ClientEx::HostContext &,TStr1 &&,TStr2 &&)'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1831,35): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1831,35): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Type::Type(const Debugger::DataModel::ClientEx::HostContext &,TStr1 &&,TStr2 &&)'
1>Generating Code...
1>Done building project "SimpleIntroClientLibrary.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am also having this issue. @robmikh were you able to resolve it? If so, please enlighten me.

Nope

Damn okay, thanks. I'll let you know if i resolve it.

Hey, so I was able to resolve this by moving some declarations and definitions to an earlier point in the namespace.

Specifically, I moved: String Extraction to Earlier in ClientEx::Details

I'm not much of a C++ dev so I can't fully explain why this works. Either way, here's what I thought that led to that fix and maybe someone could confirm or correct my thinking:

The error was:

1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): error C2039: 'ExtractString': is not a member of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(452): message : see declaration of 'Debugger::DataModel::ClientEx::Details'
1><mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\packages\Microsoft.Debugging.DataModel.CppLib.1.0.0\build\native\include\DbgModelClientEx.h(1421,69): message : This diagnostic occurred in the compiler generated function 'Debugger::DataModel::ClientEx::Module::Module(const Debugger::DataModel::ClientEx::HostContext &,TStr &&)'

Looking at the line that says this diagnostic occurred in the compiler generated function.... and looking up the referenced line, I see ExtractString hasn't been added to the ClientEx namespace yet. Maybe since this is during compilation, it doesn't see the full namespace? Anyways, that's what I don't really know. I thought If I moved the ExtractString and relevant declarations and definitions earlier in the namespace then it would be fixed and it was!

1>------ Build started: Project: SimpleIntroClientLibrary, Configuration: Debug x64 ------
1>HelloProvider.cpp
1>SimpleIntroExtension.cpp
1>Generating Code...
1>   Creating library <mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\x64\Debug\SimpleIntroClientLibrary.lib and object <mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\x64\Debug\SimpleIntroClientLibrary.exp
1>SimpleIntroClientLibrary.vcxproj -> <mypath>\WinDbg-Samples\DataModelHelloWorld\Cpp\x64\Debug\SimpleIntroClientLibrary.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

If this solution makes sense, I can create a PR for DbgModelClientEx.h

I still get some errors. Since this isn't affecting my build, I will ignore these except they change expected functionality in any relevant way

image

Hmmm, that's interesting. I'm also getting a similar error in other header libraries for similar reasons. I wonder if there's a compiler bug or if an old bad behavior was recently patched...

Thanks for finding a work around!