0

So I'm developing an app that uses the desktop duplication API, however, when using the IDXGIDevice interface and trying to access its getParent method I get the following error

class "IDXGIDevice" has no member "GetParent"

When using header files and the scope resolution operator like this

DDAPI.h

#include <d3d11.h>
#include <dxgi1_2.h>

class DDAPI 
{
public:
    HRESULT InitDDA();
private:
    ID3D11Device* m_Device;
}

DDAPI.cpp

HRESULT DDAPI::InitDDA()
{
    IDXGIDevice* pDevice = nullptr;
    IDXGIAdapter* pAdapter = nullptr;

    m_Device->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDevice);
    pDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pAdapter); // Errors Here
}

(I have already initialised ID3D11Device m_Device)

However If I was to create the class within the DDAPI.cpp file like this, it works and does not give me an error

class DDAPI
{
    ID3D11Device* m_Device;
    HRESULT InitDDA()
    {
        IDXGIDevice* pDevice = nullptr;
        IDXGIAdapter* pAdapter = nullptr;

        m_Device->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDevice);
        pDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pAdapter);


    }
};

In the first example, IntelliSense does not show all the other methods that IDXGIDevice has (Just contains the base IUnknown interface methods) but it does in the 2nd example

This might just be an IntelliSense error, as there are no build errors, but if it's showing up as an error, I'm assuming it means I can do this another way

  • I don't see any mistake... or trouble.. is it the same behaviour if you do the class definition in the header file? What happens, if you remove the public: and private: in your first example? BTW it shall not have any effect! – MiniMik Sep 10 '21 at 12:11
  • Must be an intellisense parser error. Not uncommon! – Martin.Martinsson Sep 10 '21 at 12:16
  • Removed the public and private, no change, are you aware of any ways to fix IntelliSense? It's not affecting the build, that's the important part but it's annoying to see errors and not get the IntelliSense predictions. – dawidchar Sep 10 '21 at 13:04
  • I'm using the following project from NVIDIA as a guide ([GITHUB Link](https://github.com/NVIDIA/video-sdk-samples/tree/master/nvEncDXGIOutputDuplicationSample)), I realised that their project also contains the same error on `Line 58, 64, 74` in the `DDAImpl.cpp` file – dawidchar Sep 10 '21 at 13:27

0 Answers0