Missing Namespaces on Windows 8.1 Target/Visual Studio 2017.

Started by
2 comments, last by L. Spiro 6 years, 8 months ago

I haven’t touched Windows development since Windows Vista, and I have only worked with the Win32 API (not MFC or etc.)

I got a project from online that was made for Visual Studio 2015 and up to Windows 8.1, but I see no reason I should not be able to compile it with Visual Studio 2017 (I am running Windows 10 but I don’t think it was re-targeted towards Windows 10 during the project upgrade).

But it gives me this error:


using Microsoft::WRL::ComPtr; // Error	C2653	'Microsoft': is not a class or namespace name

Obviously searching for what I need to #include to get a namespace called “Microsoft” is useless—the returns are just MSDN articles explaining what namespaces are as it is not clever enough to realize I am telling it that the namespace is named Microsoft.

So clearly I am missing some #include but this is a bit baffling as the project should just work.  My research shows this is part of a “Universal” framework.  I’ve spent the last 4 hours adding all the optional components to Visual Studio 2017 that could possibly be related and nothing fixes it.

What the hell is this, what is the missing #include, and what the hell components do I need in Visual Studio 2017?


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Advertisement

Try this:


#include <wrl.h>

ComPtr isn't strictly a part of the Universal Windows framework, it's actually a part of the Windows Runtime C++ template library. I've used it for storing references to D3D11 COM objects even when using Win32. It should come as part of the Windows SDK.

More info can be found here: https://msdn.microsoft.com/en-us/library/hh438466.aspx

The reference for the class is here:  https://msdn.microsoft.com/en-us/library/br244983.aspx

That did it.  Don’t know why that was not part of the original code, but thank you.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement